OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How do I get Flake8 to work with F811 errors?

  • Thread starter Thread starter Chris B.
  • Start date Start date
C

Chris B.

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

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?
<p>We're using <code>flake8</code> to test our code, and we're using <code>pytest</code> with fixtures. The following code:</p>

<pre><code>from staylists.tests.fixtures import fixture1 # noqa: F401

def test_case(fixture1): # noqa: F811
# Test goes here
assert 1 == 1
</code></pre>

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

<ul>
<li><strong>Why does it ignore the noqa flag?</strong> </li>
<li><strong>Is there a better way to avoid flagging this error?</strong> </li>
</ul>
 

Latest posts

Top