Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8fd396bd
Commit
8fd396bd
authored
Feb 11, 2013
by
Michael Foord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 17502: unittest discovery should use self.testLoader
parent
6c22b1d7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
1 deletion
+20
-1
Lib/unittest/main.py
Lib/unittest/main.py
+4
-1
Lib/unittest/test/test_discovery.py
Lib/unittest/test/test_discovery.py
+14
-0
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/unittest/main.py
View file @
8fd396bd
...
...
@@ -197,7 +197,10 @@ class TestProgram(object):
self
.
test
=
self
.
testLoader
.
loadTestsFromNames
(
self
.
testNames
,
self
.
module
)
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
import
optparse
...
...
Lib/unittest/test/test_discovery.py
View file @
8fd396bd
...
...
@@ -253,12 +253,26 @@ class TestDiscovery(unittest.TestCase):
program
=
TestableTestProgram
()
program
.
usageExit
=
usageExit
program
.
testLoader
=
None
with
self
.
assertRaises
(
Stop
):
# too many args
program
.
_do_discovery
([
'one'
,
'two'
,
'three'
,
'four'
])
def
test_command_line_handling_do_discovery_uses_default_loader
(
self
):
program
=
object
.
__new__
(
unittest
.
TestProgram
)
class
Loader
(
object
):
args
=
[]
def
discover
(
self
,
start_dir
,
pattern
,
top_level_dir
):
self
.
args
.
append
((
start_dir
,
pattern
,
top_level_dir
))
return
'tests'
program
.
testLoader
=
Loader
program
.
_do_discovery
([
'-v'
])
self
.
assertEqual
(
Loader
.
args
,
[(
'.'
,
'test*.py'
,
None
)])
def
test_command_line_handling_do_discovery_calls_loader
(
self
):
program
=
TestableTestProgram
()
...
...
Misc/NEWS
View file @
8fd396bd
...
...
@@ -221,6 +221,8 @@ Core and Builtins
Library
-------
- Issue #17502: unittest discovery should use self.testLoader.
- Issue #17141: random.vonmisesvariate() no more hangs for large kappas.
- Issue #17149: Fix random.vonmisesvariate to always return results in
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment