#11420: make test suite pass with -B/DONTWRITEBYTECODE set. Initial patch by Thomas Wouters.
diff --git a/Lib/test/test_imp.py b/Lib/test/test_imp.py
index 551ad1b..5df8915 100644
--- a/Lib/test/test_imp.py
+++ b/Lib/test/test_imp.py
@@ -153,9 +153,11 @@
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)