-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pytest fails collecting on py25 with "import file mismatch" - HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules #223
Comments
Original comment by Ronny Pfannschmidt (BitBucket: RonnyPfannschmidt, GitHub: RonnyPfannschmidt): did a quick test with 2.7 - it failed like described and it looks precisely like the issue is the documented py.test test file discovery and import mechanics the files imported dont necessaryly fit whats supposed to be on the pythonpath due to workdir vs install site with py.test discovering the tests in the workdir while its actually desired to collect in the install site i think correct use of |
Original comment by Sorin Sbarnea (BitBucket: sorin, GitHub: sorin): Ronny, something doesn't work well between Here is the final expected behavior: running I just updated the setup.py from tendo so it will run tox when you do So now something is clear, py.test worked if called directly from setup.py (without tox), but when called by tox it fails. |
Original comment by BitBucket: riklaunim, GitHub: riklaunim: I got it when using pytest-django and after adding an integration test based on django TestCase. The error shows up only when tested via tox. Solution: where "tests" is my tests folder (without that it would test django and everything else discovered. |
Original comment by Michael Aye (BitBucket: michaelaye, GitHub: michaelaye): I got this problem after I moved tests from proj_name/tests to proj_name/package_name/tests. Suddenly I can't run the tests anymore. Using py2.7 via conda and py.test 2.5.2 |
Original comment by Michael Aye (BitBucket: michaelaye, GitHub: michaelaye): It's ok, I had the old path in pycache. I wasn't ignoring that error message, I just overlooked that the test folder has its own pycache. Sorry for the noise. |
Originally reported by: Sorin Sbarnea (BitBucket: sorin, GitHub: sorin)
I use tox + pytest to test my python module but pytest fails to run on python2.5 giving something like:
Please take a look at https://github.com/pycontribs/tendo
I am running the tests with the
test
shell script from the repository root. Everything goes well for python 2.6 and 2.7 but for 2.5 pytest complains about this.I know that others had similar problems when they included the tests in the libraries but this should be possible, especially for small modules.
The text was updated successfully, but these errors were encountered: