diff options
author | Michael Foord <michael@voidspace.org.uk> | 2012-03-12 22:24:46 (GMT) |
---|---|---|
committer | Michael Foord <michael@voidspace.org.uk> | 2012-03-12 22:24:46 (GMT) |
commit | b36c70c9ff3c39441c8ab2ac264d039d98a47f67 (patch) | |
tree | 8c899a60e73ba9891e4f966b15c537dd1a89604b /Lib | |
parent | c1f5d8af57f2cabb2eb19f84d6fab2fbdd86293b (diff) | |
download | cpython-b36c70c9ff3c39441c8ab2ac264d039d98a47f67.zip cpython-b36c70c9ff3c39441c8ab2ac264d039d98a47f67.tar.gz cpython-b36c70c9ff3c39441c8ab2ac264d039d98a47f67.tar.bz2 |
Move adding unittest test discovery command line options into their own method.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/unittest/main.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/unittest/main.py b/Lib/unittest/main.py index dc64575..a25a2f8 100644 --- a/Lib/unittest/main.py +++ b/Lib/unittest/main.py @@ -211,11 +211,7 @@ class TestProgram(object): elif options.quiet: self.verbosity = 0 - - def _do_discovery(self, argv, Loader=loader.TestLoader): - # handle command line args for test discovery - self.progName = '%s discover' % self.progName - parser = self._getOptParser() + def _addDiscoveryOptions(self, parser): parser.add_option('-s', '--start-directory', dest='start', default='.', help="Directory to start discovery ('.' default)") parser.add_option('-p', '--pattern', dest='pattern', default='test*.py', @@ -223,6 +219,12 @@ class TestProgram(object): parser.add_option('-t', '--top-level-directory', dest='top', default=None, help='Top level directory of project (defaults to start directory)') + def _do_discovery(self, argv, Loader=loader.TestLoader): + # handle command line args for test discovery + self.progName = '%s discover' % self.progName + parser = self._getOptParser() + self._addDiscoveryOptions(parser) + options, args = parser.parse_args(argv) if len(args) > 3: self.usageExit() |