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
c823c4f6
Commit
c823c4f6
authored
Oct 29, 2010
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make check_warnings error messages more informative
parent
a4c197df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
Lib/test/support.py
Lib/test/support.py
+7
-7
No files found.
Lib/test/support.py
View file @
c823c4f6
...
...
@@ -596,22 +596,22 @@ def _filterwarnings(filters, quiet=False):
sys
.
modules
[
'warnings'
].
simplefilter
(
"always"
)
yield
WarningsRecorder
(
w
)
# Filter the recorded warnings
reraise
=
[
warning
.
message
for
warning
in
w
]
reraise
=
list
(
w
)
missing
=
[]
for
msg
,
cat
in
filters
:
seen
=
False
for
exc
in
reraise
[:]:
message
=
str
(
exc
)
for
w
in
reraise
[:]:
warning
=
w
.
message
# Filter out the matching messages
if
(
re
.
match
(
msg
,
message
,
re
.
I
)
and
issubclass
(
exc
.
__class__
,
cat
)):
if
(
re
.
match
(
msg
,
str
(
warning
)
,
re
.
I
)
and
issubclass
(
warning
.
__class__
,
cat
)):
seen
=
True
reraise
.
remove
(
exc
)
reraise
.
remove
(
w
)
if
not
seen
and
not
quiet
:
# This filter caught nothing
missing
.
append
((
msg
,
cat
.
__name__
))
if
reraise
:
raise
AssertionError
(
"unhandled warning %
r
"
%
reraise
[
0
])
raise
AssertionError
(
"unhandled warning %
s
"
%
reraise
[
0
])
if
missing
:
raise
AssertionError
(
"filter (%r, %s) did not catch any warning"
%
missing
[
0
])
...
...
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