How do I get Flake8 to work with F811 errors?

后端 未结 2 1313
自闭症患者
自闭症患者 2020-12-18 06:09

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

from staylists.tests.fixtures impo         


        
2条回答
  •  天涯浪人
    2020-12-18 07:06

    There are two "best practices" for sharing fixtures:

    1. define them in a conftest above both test modules
      • pytest will automatically share them between the two tests
    2. define a pytest plugin which exposes fixtures
      • pytest will make your fixtures available to all tests

    bringing a fixture into a scope via import side-effects will trigger the issues you're seeing and is not recommended

提交回复
热议问题