我在包中有一个文件名中带有“test”,当我运行 pytest 时出现错误
import file mismatch:
imported module 'my_project.my_file_test' has this __file__ attribute:
/my_project/src/my_project/build/lib/python2.7/site-packages/foo/my_file_test.py
which is not the same as the test file we want to collect:
/my_project/src/my_project/build/private/python2.7/lib/foo/my_file_test.py
HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules
如果我从文件中删除“测试”,它可以正常工作,但不幸的是我无法更改它。
所以问题是如何告诉pytest忽略这个文件?
慕莱坞森
相关分类