パッケージに「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
ファイルから「test」を削除すると正常に動作しますが、残念ながら変更できません。
問題は、pytest にこのファイルを無視するように指示する方法です。