summaryrefslogtreecommitdiffstats
path: root/Lib/unittest
diff options
context:
space:
mode:
authorMichael Foord <fuzzyman@voidspace.org.uk>2010-03-27 12:55:19 (GMT)
committerMichael Foord <fuzzyman@voidspace.org.uk>2010-03-27 12:55:19 (GMT)
commitff889396a845a557aa440a6960fcc5d8e6d9033a (patch)
treefed4f3116d82b7573fa4c755f30a3226b0add746 /Lib/unittest
parent9588d998d593f165403dd9f105b55aa2489ce47c (diff)
downloadcpython-ff889396a845a557aa440a6960fcc5d8e6d9033a.zip
cpython-ff889396a845a557aa440a6960fcc5d8e6d9033a.tar.gz
cpython-ff889396a845a557aa440a6960fcc5d8e6d9033a.tar.bz2
A fix for running unittest tests on platforms without the audioop module (e.g. jython and IronPython)
Diffstat (limited to 'Lib/unittest')
-rw-r--r--Lib/unittest/test/dummy.py1
-rw-r--r--Lib/unittest/test/test_loader.py20
2 files changed, 7 insertions, 14 deletions
diff --git a/Lib/unittest/test/dummy.py b/Lib/unittest/test/dummy.py
new file mode 100644
index 0000000..e4f14e4
--- /dev/null
+++ b/Lib/unittest/test/dummy.py
@@ -0,0 +1 @@
+# Empty module for testing the loading of modules
diff --git a/Lib/unittest/test/test_loader.py b/Lib/unittest/test/test_loader.py
index 7a3a59d..032423a 100644
--- a/Lib/unittest/test/test_loader.py
+++ b/Lib/unittest/test/test_loader.py
@@ -524,12 +524,8 @@ class Test_TestLoader(unittest.TestCase):
# We're going to try to load this module as a side-effect, so it
# better not be loaded before we try.
#
- # Why pick audioop? Google shows it isn't used very often, so there's
- # a good chance that it won't be imported when this test is run
- module_name = 'audioop'
-
- if module_name in sys.modules:
- del sys.modules[module_name]
+ module_name = 'unittest.test.dummy'
+ sys.modules.pop(module_name, None)
loader = unittest.TestLoader()
try:
@@ -538,7 +534,7 @@ class Test_TestLoader(unittest.TestCase):
self.assertIsInstance(suite, loader.suiteClass)
self.assertEqual(list(suite), [])
- # audioop should now be loaded, thanks to loadTestsFromName()
+ # module should now be loaded, thanks to loadTestsFromName()
self.assertIn(module_name, sys.modules)
finally:
if module_name in sys.modules:
@@ -911,12 +907,8 @@ class Test_TestLoader(unittest.TestCase):
# We're going to try to load this module as a side-effect, so it
# better not be loaded before we try.
#
- # Why pick audioop? Google shows it isn't used very often, so there's
- # a good chance that it won't be imported when this test is run
- module_name = 'audioop'
-
- if module_name in sys.modules:
- del sys.modules[module_name]
+ module_name = 'unittest.test.dummy'
+ sys.modules.pop(module_name, None)
loader = unittest.TestLoader()
try:
@@ -925,7 +917,7 @@ class Test_TestLoader(unittest.TestCase):
self.assertIsInstance(suite, loader.suiteClass)
self.assertEqual(list(suite), [unittest.TestSuite()])
- # audioop should now be loaded, thanks to loadTestsFromName()
+ # module should now be loaded, thanks to loadTestsFromName()
self.assertIn(module_name, sys.modules)
finally:
if module_name in sys.modules: