First of all, thank you for developing this amazing flake8 plugin. I love it :)
Rule request
I want a rule that will disallow patching os.environ with mock.patch.dict:
from unittests import mock
def test_foo():
with mock.patch.dict(os.environ, {"FOO": ...}):
...
with mock.patch.dict(os.environ, {}):
...
Instead, we should use monkeypatch.setenv or monkeypatch.delenv to set or remove relevant environment variables. This also helps simply the code.
def test_foo(monkeypatch):
monkeypatch.setenv("FOO", ...)
...
monkeypatch.delenv("FOO")
...
Description
Rationale