summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/main.py
diff options
context:
space:
mode:
authorMichael Foord <michael@voidspace.org.uk>2013-02-11 00:18:07 (GMT)
committerMichael Foord <michael@voidspace.org.uk>2013-02-11 00:18:07 (GMT)
commita23a39c07d3027e5139cc6127783cab23ca1a511 (patch)
tree49977f033ba80417ba5144ef837e7e5bd852e637 /Lib/unittest/main.py
parentb4621899212f5f661ef5c25cd0b71f8b1ab39028 (diff)
parent8fd396bd227ba35e0da477e5eef70e85700f186c (diff)
downloadcpython-a23a39c07d3027e5139cc6127783cab23ca1a511.zip
cpython-a23a39c07d3027e5139cc6127783cab23ca1a511.tar.gz
cpython-a23a39c07d3027e5139cc6127783cab23ca1a511.tar.bz2
Merge
Diffstat (limited to 'Lib/unittest/main.py')
-rw-r--r--Lib/unittest/main.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/unittest/main.py b/Lib/unittest/main.py
index a25a2f8..061916c 100644
--- a/Lib/unittest/main.py
+++ b/Lib/unittest/main.py
@@ -175,6 +175,7 @@ class TestProgram(object):
self.module)
def _getOptParser(self):
+ import optparse
parser = optparse.OptionParser()
parser.prog = self.progName
parser.add_option('-v', '--verbose', dest='verbose', default=False,
@@ -219,7 +220,10 @@ 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):
+ def _do_discovery(self, argv, Loader=None):
+ if Loader is None:
+ Loader = self.testLoader
+
# handle command line args for test discovery
self.progName = '%s discover' % self.progName
parser = self._getOptParser()