r79464 - in python/trunk/Lib/unittest/test: dummy.py test_loader.py
![](https://secure.gravatar.com/avatar/8ac615df352a970211b0e3d94a307c6d.jpg?s=120&d=mm&r=g)
Author: michael.foord Date: Sat Mar 27 13:55:19 2010 New Revision: 79464 Log: A fix for running unittest tests on platforms without the audioop module (e.g. jython and IronPython) Added: python/trunk/Lib/unittest/test/dummy.py (contents, props changed) Modified: python/trunk/Lib/unittest/test/test_loader.py Added: python/trunk/Lib/unittest/test/dummy.py ============================================================================== --- (empty file) +++ python/trunk/Lib/unittest/test/dummy.py Sat Mar 27 13:55:19 2010 @@ -0,0 +1 @@ +# Empty module for testing the loading of modules Modified: python/trunk/Lib/unittest/test/test_loader.py ============================================================================== --- python/trunk/Lib/unittest/test/test_loader.py (original) +++ python/trunk/Lib/unittest/test/test_loader.py Sat Mar 27 13:55:19 2010 @@ -524,12 +524,8 @@ # 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 @@ 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 @@ # 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 @@ 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:
participants (1)
-
michael.foord