Skip to content
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 keeps running deleted tests #471

Closed
pytestbot opened this issue Feb 27, 2014 · 3 comments
Closed

pytest keeps running deleted tests #471

pytestbot opened this issue Feb 27, 2014 · 3 comments
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Mantas Zilinskis (BitBucket: montiniz, GitHub: montiniz)


i just started using pytest for my django projects.
couple days ago playing around with a test project i noticed that pytest sometimes would run some test functions which were already deleted. did not pay attention to that then.
today i started new django project with pytest-bdd, pytest-django. after creating some test function, ran tests. then decided to remove one test function. ran the test again and noticed that pytest collected the deleted test.
removed all pyc files from working direcotry, cleared all pycahe directories, ran tests and it still collected the deleted test. whatever i tried wouldn't help. i'm running on virtualenv, python 2.7, django 1.6., MacOSX 10.9.1, SublimeText 3beta.
what would be the way to debug this?


@pytestbot
Copy link
Contributor Author

Original comment by Jurko Gospodnetić (BitBucket: jurko, GitHub: jurko):


Have you tried running pytest with the --collect-only command-line option? That should tell you the exact list of tests collected, including all related information - module, test class, test class instance, test method/function.

I do not think pytest makes a copy of your tests anywhere 😄 so more than likely you simply forgot to remove whatever location pytest is collecting those tests from.

For example, I occasionally remove a test module, rerun a py2to3 transformation and then run py3 tests, only to find the removed tests still being run. This happens because py2to3 converts existing py2 modules to py3 in some build folder but does not remove existing py3 modules in that build folder for which there is no longer a corresponding py2 module. A simple fix for my situation is to manually remove the build folder when something like that occurs.

Hope this helps.

Best regards,
Jurko Gospodnetić

@pytestbot
Copy link
Contributor Author

Original comment by Jurko Gospodnetić (BitBucket: jurko, GitHub: jurko):


@montiniz - you still following this issue? Could you give some more information on it? Have you tried the --collect-only command-line option?

Best regards,
Jurko Gospodnetić

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


pytest won't load tests from pyc files only -- it only collects ones that have a .py files. And indeed, pytest itself certainly does not copy files. Please check your environment and what directories are actually collected like Jurko suggested. If anything, this is a case of coming to IRC (#pylib or #python) and asking for help there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant