On Tue, May 02, 2017 at 04:15:22PM -0400, Chris Bergstresser wrote:
> 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?

This works for me: if I copy your 4-line snippet into a file and run
flake8, I get one warning (E302 expected 2 blank lines, found 1).  If I
remove both noqa comments, I get three warnings (F401, E302, F811).

Tried with two flake8 versions -- whatever I had before, which was

$ flake8 --version
3.2.1 (pyflakes: 1.3.0, pycodestyle: 2.2.0, mccabe: 0.5.3) CPython 2.7.13 on 
Linux

and the current release, which is

3.3.0 (mccabe: 0.6.1, pycodestyle: 2.3.1, pyflakes: 1.5.0) CPython 2.7.13 on 
Linux

HTH,
Marius Gedminas
-- 
The primary purpose of the DATA statement is to give names to constants;
instead of referring to PI as 3.141592653589797, at every appearance,
the variable PI can be given that value with a DATA statement, and
used instead of the longer form of the constant. This also simplifies
modifying the program, should the value of PI change.
                -- Fortran manual for Xerox computers

Attachment: signature.asc
Description: PGP signature

_______________________________________________
code-quality mailing list
code-quality@python.org
https://mail.python.org/mailman/listinfo/code-quality

Reply via email to