summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_import.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-07-31 11:39:42 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2012-07-31 11:39:42 (GMT)
commit336d9ac6bd4b673db84dbecef7d064f19ea546ad (patch)
treea743014ec9cc7f86af97ec4efc11f4d766281591 /Lib/test/test_import.py
parent42c0766a53d88756158cd0157faa7c8560c70c3b (diff)
downloadcpython-336d9ac6bd4b673db84dbecef7d064f19ea546ad.zip
cpython-336d9ac6bd4b673db84dbecef7d064f19ea546ad.tar.gz
cpython-336d9ac6bd4b673db84dbecef7d064f19ea546ad.tar.bz2
Issue #15425: Don't rely on the assumption that the current working directory is on sys.path (this will hopefully appease the XP buildbots)
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r--Lib/test/test_import.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
index 7089328..2e58199 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -859,16 +859,14 @@ class ImportTracebackTests(unittest.TestCase):
def _setup_broken_package(self, parent, child):
pkg_name = "_parent_foo"
- def cleanup():
- rmtree(pkg_name)
- unload(pkg_name)
- os.mkdir(pkg_name)
- self.addCleanup(cleanup)
+ self.addCleanup(unload, pkg_name)
+ pkg_path = os.path.join(TESTFN, pkg_name)
+ os.mkdir(pkg_path)
# 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:
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:
f.write(child)
importlib.invalidate_caches()