[code-quality] F811 errors with pytest fixtures?

Chris Bergstresser chris at subtlety.com
Tue May 2 16:15:22 EDT 2017


Hi all --

We're using flake8 to test our code, and we're using pytest with
fixtures. The following code:

----
from staylists.tests.fixtures import fixture1  # noqa: F401

def test_case(fixture1):  # noqa: F811
    # Test goes here
    assert 1 == 1
----

Generates a "lib/python/test.py:3:1: F811 redefinition of unused
'fixture1' from line 1" error during linting.

Why does it ignore the noqa flag?
Is there a better way to avoid flagging this error?

-- Chris


More information about the code-quality mailing list