#11420: make test suite pass with -B/DONTWRITEBYTECODE set. Initial patch by Thomas Wouters.

This commit is contained in:
Ezio Melotti 2013-03-16 19:48:51 +02:00
parent 58e1e50be1
commit c28f6fa505
6 changed files with 52 additions and 29 deletions

View file

@ -153,9 +153,11 @@ class ImportTests(unittest.TestCase):
mod = imp.load_source(temp_mod_name, temp_mod_name + '.py')
self.assertEqual(mod.a, 1)
mod = imp.load_compiled(
temp_mod_name, imp.cache_from_source(temp_mod_name + '.py'))
self.assertEqual(mod.a, 1)
if not sys.dont_write_bytecode:
mod = imp.load_compiled(
temp_mod_name,
imp.cache_from_source(temp_mod_name + '.py'))
self.assertEqual(mod.a, 1)
if not os.path.exists(test_package_name):
os.mkdir(test_package_name)