Skip to content

python_files causes reload to fail? #435

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

Closed
pytestbot opened this issue Jan 30, 2014 · 6 comments
Closed

python_files causes reload to fail? #435

pytestbot opened this issue Jan 30, 2014 · 6 comments
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Wayne Werner (BitBucket: waynew, GitHub: waynew)


I am the author of https://github.com/waynew/draftin-a-flask and am using py.test for all my testing needs (Frikken fantastic tool, thanks everyone for your work!) But I've come across the strangest issue. When I add

[pytest]
python_files=*.py

to my tox.ini script, it seems to break the reload function. Check out revision aaf37795dfc49bd83e66976e3e781eb7a588caeb to observe this one weird behavior that developers love to hate.


@pytestbot
Copy link
Contributor Author

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


Sorry for taking a while. Could you try to run your tests with "--assert=no" and see if that helps with reloading? If not, how can i reproduce the issue?

@pytestbot
Copy link
Contributor Author

Original comment by Wayne Werner (BitBucket: waynew, GitHub: waynew):


--assert=plain does not throw the error with reload not being defined.

I think it might actually have something to do with picking up the setup.py file. When I changed it to python_files=tests/*.py things seemed to clear up.

@pytestbot
Copy link
Contributor Author

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


Could you try to guard your setup.py by only invoking setup when __name__ == "__main__" to verify the theory?

@pytestbot
Copy link
Contributor Author

Original comment by Wayne Werner (BitBucket: waynew, GitHub: waynew):


Looks like I was incorrect - I even tried removing setup.py, and no dice - I still get the problem with reload missing from sys.modules

@pytestbot
Copy link
Contributor Author

Original comment by Daniel Hahler (BitBucket: blueyed, GitHub: blueyed):


Here is a fix for it: https://bitbucket.org/pytest-dev/pytest/pull-request/259/fix-reload-for-files-matched-by

@pytestbot
Copy link
Contributor Author

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


fix issue435: make reload() work when assert rewriting is active.
Thanks Daniel Hahler.

@pytestbot pytestbot added the type: bug problem that needs to be addressed label Jun 15, 2015
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