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
b88fbf4f
Commit
b88fbf4f
authored
Mar 21, 2010
by
Florent Xicluna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use assertRaises and add a specific warning filter.
parent
aa89f8d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
Lib/test/test_importhooks.py
Lib/test/test_importhooks.py
+4
-9
No files found.
Lib/test/test_importhooks.py
View file @
b88fbf4f
...
...
@@ -227,15 +227,9 @@ class ImportHooksTestCase(ImportHooksBaseTestCase):
def
testBlocker
(
self
):
mname
=
"exceptions"
# an arbitrary harmless builtin module
if
mname
in
sys
.
modules
:
del
sys
.
modules
[
mname
]
test_support
.
unload
(
mname
)
sys
.
meta_path
.
append
(
ImportBlocker
(
mname
))
try
:
__import__
(
mname
)
except
ImportError
:
pass
else
:
self
.
fail
(
"'%s' was not supposed to be importable"
%
mname
)
self
.
assertRaises
(
ImportError
,
__import__
,
mname
)
def
testImpWrapper
(
self
):
i
=
ImpWrapper
()
...
...
@@ -247,7 +241,8 @@ class ImportHooksTestCase(ImportHooksBaseTestCase):
for
n
in
sys
.
modules
.
keys
():
if
n
.
startswith
(
parent
):
del
sys
.
modules
[
n
]
with
test_support
.
check_warnings
():
with
test_support
.
check_warnings
((
"The compiler package is deprecated "
"and removed"
,
DeprecationWarning
)):
for
mname
in
mnames
:
m
=
__import__
(
mname
,
globals
(),
locals
(),
[
"__dummy__"
])
m
.
__loader__
# to make sure we actually handled the import
...
...
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