From: Michael Foord <michael@voidspace.org.uk>
Date: Mon, 11 Feb 2013 12:53:21 +0000 (+0000)
Subject: Correction to issue 17052 fix
X-Git-Tag: v2.7.4rc1~125
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c36bf9918929ae37db1fea149ff9d9d408e62943;p=python

Correction to issue 17052 fix
---

diff --git a/Lib/unittest/main.py b/Lib/unittest/main.py
index 1e001a6a26..b25367992d 100644
--- a/Lib/unittest/main.py
+++ b/Lib/unittest/main.py
@@ -159,7 +159,7 @@ class TestProgram(object):
 
     def _do_discovery(self, argv, Loader=None):
         if Loader is None:
-            Loader = self.testLoader
+            Loader = lambda: self.testLoader
 
         # handle command line args for test discovery
         self.progName = '%s discover' % self.progName
diff --git a/Lib/unittest/test/test_discovery.py b/Lib/unittest/test/test_discovery.py
index 3dec2ee57e..8c031a0034 100644
--- a/Lib/unittest/test/test_discovery.py
+++ b/Lib/unittest/test/test_discovery.py
@@ -236,7 +236,7 @@ class TestDiscovery(unittest.TestCase):
                 self.args.append((start_dir, pattern, top_level_dir))
                 return 'tests'
 
-        program.testLoader = Loader
+        program.testLoader = Loader()
         program._do_discovery(['-v'])
         self.assertEqual(Loader.args, [('.', 'test*.py', None)])
 
diff --git a/Misc/NEWS b/Misc/NEWS
index d5186d3353..a65c0911e7 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -202,7 +202,7 @@ Core and Builtins
 Library
 -------
 
-- Issue #17502: unittest discovery should use self.testLoader.
+- Issue #17052: unittest discovery should use self.testLoader.
 
 - Issue #17141: random.vonmisesvariate() no more hangs for large kappas.