summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unittest.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_unittest.py')
-rw-r--r--Lib/test/test_unittest.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_unittest.py b/Lib/test/test_unittest.py
index 70f12d2..327d65f 100644
--- a/Lib/test/test_unittest.py
+++ b/Lib/test/test_unittest.py
@@ -540,7 +540,8 @@ class Test_TestLoader(TestCase):
# audioop should now be loaded, thanks to loadTestsFromName()
self.failUnless(module_name in sys.modules)
finally:
- del sys.modules[module_name]
+ if module_name in sys.modules:
+ del sys.modules[module_name]
################################################################
### Tests for TestLoader.loadTestsFromName()
@@ -936,7 +937,8 @@ class Test_TestLoader(TestCase):
# audioop should now be loaded, thanks to loadTestsFromName()
self.failUnless(module_name in sys.modules)
finally:
- del sys.modules[module_name]
+ if module_name in sys.modules:
+ del sys.modules[module_name]
################################################################
### /Tests for TestLoader.loadTestsFromNames()