Move adding unittest test discovery command line options into their own method.

This commit is contained in:
Michael Foord 2012-03-12 15:24:46 -07:00
parent c1f5d8af57
commit b36c70c9ff

View File

@ -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()