Use fixup_namespace_packages also with pytester.syspathinsert
This commit is contained in:
parent
05d55b86df
commit
5df45f5b27
|
@ -1 +1 @@
|
||||||
``monkeypatch.syspath_prepend`` calls ``pkg_resources.fixup_namespace_packages`` to handle namespace packages better.
|
Namespace packages are handled better with ``monkeypatch.syspath_prepend`` and ``testdir.syspathinsert`` (via ``pkg_resources.fixup_namespace_packages``).
|
||||||
|
|
|
@ -593,11 +593,16 @@ class Testdir(object):
|
||||||
|
|
||||||
This is undone automatically when this object dies at the end of each
|
This is undone automatically when this object dies at the end of each
|
||||||
test.
|
test.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
from pkg_resources import fixup_namespace_packages
|
||||||
|
|
||||||
if path is None:
|
if path is None:
|
||||||
path = self.tmpdir
|
path = self.tmpdir
|
||||||
sys.path.insert(0, str(path))
|
|
||||||
|
dirname = str(path)
|
||||||
|
sys.path.insert(0, dirname)
|
||||||
|
fixup_namespace_packages(dirname)
|
||||||
|
|
||||||
# a call to syspathinsert() usually means that the caller wants to
|
# a call to syspathinsert() usually means that the caller wants to
|
||||||
# import some dynamically created files, thus with python3 we
|
# import some dynamically created files, thus with python3 we
|
||||||
# invalidate its import caches
|
# invalidate its import caches
|
||||||
|
|
Loading…
Reference in New Issue