]> granicus.if.org Git - python/commitdiff
Fix spurious test failure of test_socket_ssl when run in this order:
authorNeal Norwitz <nnorwitz@gmail.com>
Sat, 4 Mar 2006 23:13:41 +0000 (23:13 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Sat, 4 Mar 2006 23:13:41 +0000 (23:13 +0000)
  test_codecmaps_tw test_importhooks test_socket_ssl

I don't completely understand the cause, but there's a lot of import magic
going on and this is the smallest change which fixes the problem.

Lib/test/test_importhooks.py

index 5af7847aa45013289b4a286ab98ab3fe2d922c8f..81b7ad1ba12394033f373a2198f3eda53bdbcd8e 100644 (file)
@@ -252,6 +252,10 @@ class ImportHooksTestCase(ImportHooksBaseTestCase):
         for mname in mnames:
             m = __import__(mname, globals(), locals(), ["__dummy__"])
             m.__loader__  # to make sure we actually handled the import
+        # Delete urllib from modules because urlparse was imported above.  
+        # Without this hack, test_socket_ssl fails if run in this order:
+        # regrtest.py test_codecmaps_tw test_importhooks test_socket_ssl
+        del sys.modules['urllib']
 
 def test_main():
     test_support.run_unittest(ImportHooksTestCase)