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
cb66ee7f
Commit
cb66ee7f
authored
Feb 10, 2013
by
Michael Foord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 17502: unittest discovery should use self.testLoader
parent
65d56390
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 @
cb66ee7f
...
...
@@ -157,7 +157,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 @
cb66ee7f
...
...
@@ -220,12 +220,26 @@ class TestDiscovery(unittest.TestCase):
program
=
object
.
__new__
(
unittest
.
TestProgram
)
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
=
object
.
__new__
(
unittest
.
TestProgram
)
...
...
Misc/NEWS
View file @
cb66ee7f
...
...
@@ -202,6 +202,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