summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test
diff options
context:
space:
mode:
authorMichael Foord <michael@voidspace.org.uk>2013-02-10 23:59:46 (GMT)
committerMichael Foord <michael@voidspace.org.uk>2013-02-10 23:59:46 (GMT)
commitcb66ee7f56fe66d4b4cb7bc6abe6e1314e98b5c9 (patch)
treeae5778d85c5fad29f616c33cb6344eddd6d74f54 /Lib/unittest/test
parent65d56390bbf74553221dd94123c9f04776c6f8cb (diff)
downloadcpython-cb66ee7f56fe66d4b4cb7bc6abe6e1314e98b5c9.zip
cpython-cb66ee7f56fe66d4b4cb7bc6abe6e1314e98b5c9.tar.gz
cpython-cb66ee7f56fe66d4b4cb7bc6abe6e1314e98b5c9.tar.bz2
Issue 17502: unittest discovery should use self.testLoader
Diffstat (limited to 'Lib/unittest/test')
-rw-r--r--Lib/unittest/test/test_discovery.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/unittest/test/test_discovery.py b/Lib/unittest/test/test_discovery.py
index 1155de1..3dec2ee 100644
--- a/Lib/unittest/test/test_discovery.py
+++ b/Lib/unittest/test/test_discovery.py
@@ -220,12 +220,26 @@ class TestDiscovery(unittest.TestCase):
program = object.__new__(unittest.TestProgram)
program.usageExit = usageExit
+ program.testLoader = None
with self.assertRaises(Stop):
# too many args
program._do_discovery(['one', 'two', 'three', 'four'])
+ def test_command_line_handling_do_discovery_uses_default_loader(self):
+ program = object.__new__(unittest.TestProgram)
+
+ class Loader(object):
+ args = []
+ def discover(self, start_dir, pattern, top_level_dir):
+ self.args.append((start_dir, pattern, top_level_dir))
+ return 'tests'
+
+ program.testLoader = Loader
+ program._do_discovery(['-v'])
+ self.assertEqual(Loader.args, [('.', 'test*.py', None)])
+
def test_command_line_handling_do_discovery_calls_loader(self):
program = object.__new__(unittest.TestProgram)