summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_imp.py
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2010-03-06 01:50:25 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2010-03-06 01:50:25 (GMT)
commit41a6b04b1fb5dc58b07abd60598a2932a7b0649c (patch)
treeb5f20903f27686faf13499ddf002edff661a9df6 /Lib/test/test_imp.py
parent435b5318732b3fa8e5a0dd82d3538aa6bc045d8e (diff)
downloadcpython-41a6b04b1fb5dc58b07abd60598a2932a7b0649c.zip
cpython-41a6b04b1fb5dc58b07abd60598a2932a7b0649c.tar.gz
cpython-41a6b04b1fb5dc58b07abd60598a2932a7b0649c.tar.bz2
The test was failing because the curdir was missing from sys.path. This should fix the problem.
Diffstat (limited to 'Lib/test/test_imp.py')
-rw-r--r--Lib/test/test_imp.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index 3ef1e10..5ba0ed8 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -113,6 +113,9 @@ class ImportTests(unittest.TestCase):
test_package_name = 'test_imp_helper_package_' + decoded_char
init_file_name = os.path.join(test_package_name, '__init__.py')
try:
+ # if the curdir is not in sys.path the test fails when run with
+ # ./python ./Lib/test/regrtest.py test_imp
+ sys.path.insert(0, os.curdir)
with open(temp_mod_name + '.py', 'w') as file:
file.write('a = 1\n')
file, filename, info = imp.find_module(temp_mod_name)
@@ -139,6 +142,7 @@ class ImportTests(unittest.TestCase):
package = imp.load_package(test_package_name, test_package_name)
self.assertEqual(package.b, 2)
finally:
+ del sys.path[0]
for ext in ('.py', '.pyc', '.pyo'):
support.unlink(temp_mod_name + ext)
support.unlink(init_file_name + ext)