[Python-checkins] r78046 - in python/trunk/Lib/test: test_richcmp.py test_tempfile.py test_threaded_import.py test_zipimport.py

georg.brandl python-checkins at python.org
Sun Feb 7 00:18:00 CET 2010


Author: georg.brandl
Date: Sun Feb  7 00:18:00 2010
New Revision: 78046

Log:
Fix various missing import/unbound name errors.

Modified:
   python/trunk/Lib/test/test_richcmp.py
   python/trunk/Lib/test/test_tempfile.py
   python/trunk/Lib/test/test_threaded_import.py
   python/trunk/Lib/test/test_zipimport.py

Modified: python/trunk/Lib/test/test_richcmp.py
==============================================================================
--- python/trunk/Lib/test/test_richcmp.py	(original)
+++ python/trunk/Lib/test/test_richcmp.py	Sun Feb  7 00:18:00 2010
@@ -192,13 +192,13 @@
 
     def test_misbehavin(self):
         class Misb:
-            def __lt__(self, other): return 0
-            def __gt__(self, other): return 0
-            def __eq__(self, other): return 0
-            def __le__(self, other): raise TestFailed, "This shouldn't happen"
-            def __ge__(self, other): raise TestFailed, "This shouldn't happen"
-            def __ne__(self, other): raise TestFailed, "This shouldn't happen"
-            def __cmp__(self, other): raise RuntimeError, "expected"
+            def __lt__(self_, other): return 0
+            def __gt__(self_, other): return 0
+            def __eq__(self_, other): return 0
+            def __le__(self_, other): self.fail("This shouldn't happen")
+            def __ge__(self_, other): self.fail("This shouldn't happen")
+            def __ne__(self_, other): self.fail("This shouldn't happen")
+            def __cmp__(self_, other): raise RuntimeError, "expected"
         a = Misb()
         b = Misb()
         self.assertEqual(a<b, 0)

Modified: python/trunk/Lib/test/test_tempfile.py
==============================================================================
--- python/trunk/Lib/test/test_tempfile.py	(original)
+++ python/trunk/Lib/test/test_tempfile.py	Sun Feb  7 00:18:00 2010
@@ -127,7 +127,7 @@
                 if i == 20:
                     break
         except:
-            failOnException("iteration")
+            self.failOnException("iteration")
 
 test_classes.append(test__RandomNameSequence)
 

Modified: python/trunk/Lib/test/test_threaded_import.py
==============================================================================
--- python/trunk/Lib/test/test_threaded_import.py	(original)
+++ python/trunk/Lib/test/test_threaded_import.py	Sun Feb  7 00:18:00 2010
@@ -6,6 +6,7 @@
 # randrange, and then Python hangs.
 
 import thread
+import unittest
 from test.test_support import verbose, TestFailed
 
 critical_section = thread.allocate_lock()

Modified: python/trunk/Lib/test/test_zipimport.py
==============================================================================
--- python/trunk/Lib/test/test_zipimport.py	(original)
+++ python/trunk/Lib/test/test_zipimport.py	Sun Feb  7 00:18:00 2010
@@ -230,7 +230,7 @@
 
             mod_path = packdir2 + TESTMOD
             mod_name = module_path_to_dotted_name(mod_path)
-            pkg = __import__(mod_name)
+            __import__(mod_name)
             mod = sys.modules[mod_name]
             self.assertEquals(zi.get_source(TESTPACK), None)
             self.assertEquals(zi.get_source(mod_path), None)
@@ -274,7 +274,7 @@
 
             mod_path = TESTPACK2 + os.sep + TESTMOD
             mod_name = module_path_to_dotted_name(mod_path)
-            pkg = __import__(mod_name)
+            __import__(mod_name)
             mod = sys.modules[mod_name]
             self.assertEquals(zi.get_source(TESTPACK2), None)
             self.assertEquals(zi.get_source(mod_path), None)


More information about the Python-checkins mailing list