How do I get Flake8 to work with F811 errors?

后端 未结 2 1314
自闭症患者
自闭症患者 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 06:46

    The F401 and F811 errors can be avoided by moving all fixtures into the conftest.py file. Pytest loads this file automatically and makes all fixtures inside available in all tests, even without explicit import statements.

    More discussion about the file can be found here: In py.test, what is the use of conftest.py files?

提交回复
热议问题