You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Include a detailed description of the bug or suggestion
using reload(mymodule) or imp.reload(mymodule) inside a test is failing because _should_rewrite() gets called and it incorrectly thinks that mymodule is a conftest/test file when it is not and because of that it doesn't get reloaded.
Python 2.7.11
64 bit Linux RHEL7
pytest 3.7.2 (also tried on 3.0.6 and 3.1.0 and 2.9.1) - only 2.9.1 worked
Minimal example if possible
have a namespace yyy with a namespace package yyy.testing that includes testing utilities. Then write tests for another package yyy.mymodule and use reload() inside the tests to re-initialize things inside mymodule
The text was updated successfully, but these errors were encountered:
using
reload(mymodule)
orimp.reload(mymodule)
inside a test is failing because_should_rewrite()
gets called and it incorrectly thinks thatmymodule
is a conftest/test file when it is not and because of that it doesn't get reloaded.The problem seems to be here:
pytest/src/_pytest/assertion/rewrite.py
Line 180 in 7e92930
where
name
isand
self._must_rewrite
is*note: xxxx is our company's namespace
so,
when
name
is 'xxxx.name1.name2' andmarked
is xxxx,name.startswith(..)
returnsTrue
This seems to result from the fact that we have a testing module inside our company's namespace. It is called xxxx.testing.
This used to work on pytest 2.9.1
pip list
of the virtual environment you are usingPython 2.7.11
64 bit Linux RHEL7
pytest 3.7.2 (also tried on 3.0.6 and 3.1.0 and 2.9.1) - only 2.9.1 worked
have a namespace
yyy
with a namespace packageyyy.testing
that includes testing utilities. Then write tests for another packageyyy.mymodule
and usereload()
inside the tests to re-initialize things inside mymoduleThe text was updated successfully, but these errors were encountered: