[Python-checkins] r78711 - python/branches/py3k/Lib/test/test_imp.py

ezio.melotti python-checkins at python.org
Sat Mar 6 02:50:26 CET 2010


Author: ezio.melotti
Date: Sat Mar  6 02:50:25 2010
New Revision: 78711

Log:
The test was failing because the curdir was missing from sys.path. This should fix the problem.

Modified:
   python/branches/py3k/Lib/test/test_imp.py

Modified: python/branches/py3k/Lib/test/test_imp.py
==============================================================================
--- python/branches/py3k/Lib/test/test_imp.py	(original)
+++ python/branches/py3k/Lib/test/test_imp.py	Sat Mar  6 02:50:25 2010
@@ -113,6 +113,9 @@
         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 @@
             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)


More information about the Python-checkins mailing list