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
dc609c2b
Commit
dc609c2b
authored
Mar 19, 2016
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Try to fix test_warnings on Windows
Issue #26567.
parent
976e053c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
Lib/test/test_warnings/__init__.py
Lib/test/test_warnings/__init__.py
+10
-8
No files found.
Lib/test/test_warnings/__init__.py
View file @
dc609c2b
...
...
@@ -4,7 +4,6 @@ import os
from
io
import
StringIO
import
re
import
sys
import
tempfile
import
textwrap
import
unittest
from
test
import
support
...
...
@@ -774,8 +773,10 @@ class PyWarningsDisplayTests(WarningsDisplayTests, unittest.TestCase):
module
=
py_warnings
def
test_tracemalloc
(
self
):
with
tempfile
.
NamedTemporaryFile
(
"w"
,
suffix
=
".py"
)
as
tmpfile
:
tmpfile
.
write
(
textwrap
.
dedent
(
"""
self
.
addCleanup
(
support
.
unlink
,
support
.
TESTFN
)
with
open
(
support
.
TESTFN
,
'w'
)
as
fp
:
fp
.
write
(
textwrap
.
dedent
(
"""
def func():
f = open(__file__)
# Emit ResourceWarning
...
...
@@ -783,12 +784,12 @@ class PyWarningsDisplayTests(WarningsDisplayTests, unittest.TestCase):
func()
"""
))
tmpfile
.
flush
()
fname
=
tmpfile
.
name
res
=
assert_python_ok
(
'-Wd'
,
'-X'
,
'tracemalloc=2'
,
fname
)
res
=
assert_python_ok
(
'-Wd'
,
'-X'
,
'tracemalloc=2'
,
support
.
TESTFN
)
stderr
=
res
.
err
.
decode
(
'ascii'
,
'replace'
)
stderr
=
re
.
sub
(
'<.*>'
,
'<...>'
,
stderr
)
expected
=
textwrap
.
dedent
(
f
'''
expected
=
textwrap
.
dedent
(
'''
{fname}:5: ResourceWarning: unclosed file <...>
f = None
Object allocated at (most recent call first):
...
...
@@ -796,7 +797,8 @@ class PyWarningsDisplayTests(WarningsDisplayTests, unittest.TestCase):
f = open(__file__)
File "{fname}", lineno 7
func()
'''
).
strip
()
'''
)
expected
=
expected
.
format
(
fname
=
support
.
TESTFN
).
strip
()
self
.
assertEqual
(
stderr
,
expected
)
...
...
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