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
f1465f05
Commit
f1465f05
authored
Apr 15, 2013
by
Nick Coghlan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Close #17731: Clean up properly in test_import
parent
26dfaac9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
Lib/test/test_import.py
Lib/test/test_import.py
+3
-0
No files found.
Lib/test/test_import.py
View file @
f1465f05
...
...
@@ -43,6 +43,7 @@ def _ready_to_import(name=None, source=""):
# sets up a temporary directory and removes it
# creates the module file
# temporarily clears the module from sys.modules (if any)
# reverts or removes the module when cleaning up
name
=
name
or
"spam"
with
script_helper
.
temp_dir
()
as
tempdir
:
path
=
script_helper
.
make_script
(
tempdir
,
name
,
source
)
...
...
@@ -54,6 +55,8 @@ def _ready_to_import(name=None, source=""):
finally
:
if
old_module
is
not
None
:
sys
.
modules
[
name
]
=
old_module
elif
name
in
sys
.
modules
:
del
sys
.
modules
[
name
]
class
ImportTests
(
unittest
.
TestCase
):
...
...
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