mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
Issue #15425: Don't rely on the assumption that the current working directory is on sys.path (this will hopefully appease the XP buildbots)
This commit is contained in:
parent
42c0766a53
commit
336d9ac6bd
1 changed files with 5 additions and 7 deletions
|
@ -859,16 +859,14 @@ class ImportTracebackTests(unittest.TestCase):
|
||||||
|
|
||||||
def _setup_broken_package(self, parent, child):
|
def _setup_broken_package(self, parent, child):
|
||||||
pkg_name = "_parent_foo"
|
pkg_name = "_parent_foo"
|
||||||
def cleanup():
|
self.addCleanup(unload, pkg_name)
|
||||||
rmtree(pkg_name)
|
pkg_path = os.path.join(TESTFN, pkg_name)
|
||||||
unload(pkg_name)
|
os.mkdir(pkg_path)
|
||||||
os.mkdir(pkg_name)
|
|
||||||
self.addCleanup(cleanup)
|
|
||||||
# Touch the __init__.py
|
# Touch the __init__.py
|
||||||
init_path = os.path.join(pkg_name, '__init__.py')
|
init_path = os.path.join(pkg_path, '__init__.py')
|
||||||
with open(init_path, 'w') as f:
|
with open(init_path, 'w') as f:
|
||||||
f.write(parent)
|
f.write(parent)
|
||||||
bar_path = os.path.join(pkg_name, 'bar.py')
|
bar_path = os.path.join(pkg_path, 'bar.py')
|
||||||
with open(bar_path, 'w') as f:
|
with open(bar_path, 'w') as f:
|
||||||
f.write(child)
|
f.write(child)
|
||||||
importlib.invalidate_caches()
|
importlib.invalidate_caches()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue