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
6f17e2df
Commit
6f17e2df
authored
Dec 30, 2010
by
Michael Foord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 10786: unittest.TextTestRunner default stream no longer bound at import time
parent
30baf2b0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
1 deletion
+24
-1
Lib/unittest/runner.py
Lib/unittest/runner.py
+3
-1
Lib/unittest/test/test_runner.py
Lib/unittest/test/test_runner.py
+17
-0
Misc/NEWS
Misc/NEWS
+4
-0
No files found.
Lib/unittest/runner.py
View file @
6f17e2df
...
...
@@ -125,8 +125,10 @@ class TextTestRunner(object):
"""
resultclass
=
TextTestResult
def
__init__
(
self
,
stream
=
sys
.
stderr
,
descriptions
=
True
,
verbosity
=
1
,
def
__init__
(
self
,
stream
=
None
,
descriptions
=
True
,
verbosity
=
1
,
failfast
=
False
,
buffer
=
False
,
resultclass
=
None
,
warnings
=
None
):
if
stream
is
None
:
stream
=
sys
.
stderr
self
.
stream
=
_WritelnDecorator
(
stream
)
self
.
descriptions
=
descriptions
self
.
verbosity
=
verbosity
...
...
Lib/unittest/test/test_runner.py
View file @
6f17e2df
...
...
@@ -299,3 +299,20 @@ class Test_TextTestRunner(unittest.TestCase):
self
.
assertEqual
(
out
.
count
(
msg
),
3
)
for
msg
in
[
ae_msg
,
at_msg
]:
self
.
assertEqual
(
out
.
count
(
msg
),
1
)
def
testStdErrLookedUpAtInstantiationTime
(
self
):
# see issue 10786
old_stderr
=
sys
.
stderr
f
=
io
.
StringIO
()
sys
.
stderr
=
f
try
:
runner
=
unittest
.
TextTestRunner
()
self
.
assertTrue
(
runner
.
stream
.
stream
is
f
)
finally
:
sys
.
stderr
=
old_stderr
def
testSpecifiedStreamUsed
(
self
):
# see issue 10786
f
=
io
.
StringIO
()
runner
=
unittest
.
TextTestRunner
(
f
)
self
.
assertTrue
(
runner
.
stream
.
stream
is
f
)
Misc/NEWS
View file @
6f17e2df
...
...
@@ -20,6 +20,10 @@ Core and Builtins
Library
-------
- Issue 10786: unittest.TextTestRunner default stream no longer bound at
import time. `sys.stderr` now looked up at instantiation time. Fix contributed
by Mark Roddy.
- Issue 10753 - Characters ';','=' and ',' in the PATH_INFO environment
variable won't be quoted when the URI is constructed by the wsgiref.util 's
request_uri method. According to RFC 3986, these characters can be a part of
...
...
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