]> granicus.if.org Git - python/commitdiff
Improve test for 'python -m unittest' launching test discovery
authorMichael Foord <fuzzyman@voidspace.org.uk>
Mon, 22 Nov 2010 10:41:27 +0000 (10:41 +0000)
committerMichael Foord <fuzzyman@voidspace.org.uk>
Mon, 22 Nov 2010 10:41:27 +0000 (10:41 +0000)
Lib/unittest/test/test_discovery.py

index 7c24bf832d53523412b9533298c0a7fbc2315487..5dcbda455e4cb18721fa9004c35d7737cf98728a 100644 (file)
@@ -223,15 +223,14 @@ class TestDiscovery(unittest.TestCase):
         program = TestableTestProgram()
         program.module = None
 
-        args = []
+        self.called = False
         def do_discovery(argv):
-            args.extend(argv)
+            self.called = True
+            self.assertEqual(argv, [])
         program._do_discovery = do_discovery
         program.parseArgs(['something'])
-        self.assertEqual(args, [])
+        self.assertTrue(self.called)
 
-        program.parseArgs(['something'])
-        self.assertEqual(args, [])
 
     def test_command_line_handling_do_discovery_too_many_arguments(self):
         class Stop(Exception):