mirror of
https://github.com/python/cpython.git
synced 2024-11-27 20:04:41 +08:00
Move adding unittest test discovery command line options into their own method.
This commit is contained in:
parent
c1f5d8af57
commit
b36c70c9ff
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user