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
da2bf9f6
Commit
da2bf9f6
authored
Oct 12, 2018
by
Bruno Oliveira
Committed by
Berker Peksag
Oct 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-34900: Make TestCase.debug() work with subtests (GH-9707)
parent
4505f65a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
1 deletion
+17
-1
Lib/unittest/case.py
Lib/unittest/case.py
+1
-1
Lib/unittest/test/test_case.py
Lib/unittest/test/test_case.py
+14
-0
Misc/NEWS.d/next/Library/2018-10-05-05-55-53.bpo-34900.8RNiFu.rst
...S.d/next/Library/2018-10-05-05-55-53.bpo-34900.8RNiFu.rst
+2
-0
No files found.
Lib/unittest/case.py
View file @
da2bf9f6
...
...
@@ -514,7 +514,7 @@ class TestCase(object):
case as failed but resumes execution at the end of the enclosed
block, allowing further test code to be executed.
"""
if
not
self
.
_outcome
.
result_supports_subtests
:
if
self
.
_outcome
is
None
or
not
self
.
_outcome
.
result_supports_subtests
:
yield
return
parent
=
self
.
_subtest
...
...
Lib/unittest/test/test_case.py
View file @
da2bf9f6
...
...
@@ -425,6 +425,20 @@ class Test_TestCase(unittest.TestCase, TestEquality, TestHashing):
expected
=
[
'a1'
,
'a2'
,
'b1'
]
self
.
assertEqual
(
events
,
expected
)
def
test_subtests_debug
(
self
):
# Test debug() with a test that uses subTest() (bpo-34900)
events
=
[]
class
Foo
(
unittest
.
TestCase
):
def
test_a
(
self
):
events
.
append
(
'test case'
)
with
self
.
subTest
():
events
.
append
(
'subtest 1'
)
Foo
(
'test_a'
).
debug
()
self
.
assertEqual
(
events
,
[
'test case'
,
'subtest 1'
])
# "This class attribute gives the exception raised by the test() method.
# If a test framework needs to use a specialized exception, possibly to
# carry additional information, it must subclass this exception in
...
...
Misc/NEWS.d/next/Library/2018-10-05-05-55-53.bpo-34900.8RNiFu.rst
0 → 100644
View file @
da2bf9f6
Fixed :meth:`unittest.TestCase.debug` when used to call test methods with
subtests. Patch by Bruno Oliveira.
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