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
eb392941
Commit
eb392941
authored
Jul 15, 2011
by
Éric Araujo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Silence 2to3 warnings in packaging tests
parent
dccf9855
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
Lib/packaging/tests/support.py
Lib/packaging/tests/support.py
+8
-4
No files found.
Lib/packaging/tests/support.py
View file @
eb392941
...
...
@@ -28,13 +28,11 @@ Each class or function has a docstring to explain its purpose and usage.
"""
import
os
import
errno
import
shutil
import
logging
import
weakref
import
tempfile
from
packaging
import
logger
from
packaging.dist
import
Distribution
from
packaging.tests
import
unittest
from
test.support
import
requires_zlib
,
unlink
...
...
@@ -44,6 +42,10 @@ __all__ = ['LoggingCatcher', 'TempdirManager', 'EnvironRestorer',
'skip_unless_symlink'
,
'requires_zlib'
]
logger
=
logging
.
getLogger
(
'packaging'
)
logger2to3
=
logging
.
getLogger
(
'RefactoringTool'
)
class
_TestHandler
(
logging
.
handlers
.
BufferingHandler
):
# stolen and adapted from test.support
...
...
@@ -74,9 +76,10 @@ class LoggingCatcher:
def
setUp
(
self
):
super
(
LoggingCatcher
,
self
).
setUp
()
self
.
loghandler
=
handler
=
_TestHandler
()
self
.
old_level
=
logger
.
level
self
.
_old_levels
=
logger
.
level
,
logger2to3
.
level
logger
.
addHandler
(
handler
)
logger
.
setLevel
(
logging
.
DEBUG
)
# we want all messages
logger2to3
.
setLevel
(
logging
.
CRITICAL
)
# we don't want 2to3 messages
def
tearDown
(
self
):
handler
=
self
.
loghandler
...
...
@@ -87,7 +90,8 @@ class LoggingCatcher:
for
ref
in
weakref
.
getweakrefs
(
handler
):
logging
.
_removeHandlerRef
(
ref
)
del
self
.
loghandler
logger
.
setLevel
(
self
.
old_level
)
logger
.
setLevel
(
self
.
_old_levels
[
0
])
logger2to3
.
setLevel
(
self
.
_old_levels
[
1
])
super
(
LoggingCatcher
,
self
).
tearDown
()
def
get_logs
(
self
,
*
levels
):
...
...
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