Metadata-Version: 2.1
Name: flake8-patch
Version: 0.1.0
Summary: A flake8 plugin checking for mocking issues.
Home-page: https://pypi.org/project/flake8-patch
License: MIT
Keywords: flake8,mock
Author: Luiz Geron
Author-email: luiz@geron.me
Requires-Python: >=3.6,<4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Environment :: Plugins
Classifier: Framework :: Flake8
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Testing :: Mocking
Requires-Dist: flake8_plugin_utils (>=1.3.1,<2.0.0)
Project-URL: Repository, https://github.com/geron/flake8-patch
Description-Content-Type: text/markdown

# flake8-patch

A `flake8` plugin checking for mocking issues.

Currently reports the code `PAT001` when assignments to imported objects are detected.

## Bad code example

```python
from some_module import SomeClass

def test_something():
    SomeClass.some_method = lambda: 42
```

This is bad because `SomeClass.some_method` might be used directly or indirectly in another test, which will break randomly depending on the execution order.

## Good code example

```python
from some_module import SomeClass

def test_something(mocker):
    mocker.patch.object(SomeClass, "some_method", return_value=42)
```

This uses the mocker fixture from `pytest-mock` to automatically unwind the patch after the test method runs.

## Change Log

**Unreleased**

...

**0.1.0 - 2020-10-02**

Add PAT001: assignment to imported name

