Kaydet (Commit) b87ef8f8 authored tarafından Michael Foord's avatar Michael Foord

Improve test for 'python -m unittest' launching test discovery

üst 5cbc71e5
...@@ -223,15 +223,14 @@ class TestDiscovery(unittest.TestCase): ...@@ -223,15 +223,14 @@ class TestDiscovery(unittest.TestCase):
program = TestableTestProgram() program = TestableTestProgram()
program.module = None program.module = None
args = [] self.called = False
def do_discovery(argv): def do_discovery(argv):
args.extend(argv) self.called = True
self.assertEqual(argv, [])
program._do_discovery = do_discovery program._do_discovery = do_discovery
program.parseArgs(['something']) 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): def test_command_line_handling_do_discovery_too_many_arguments(self):
class Stop(Exception): class Stop(Exception):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment