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
788d7667
Commit
788d7667
authored
Oct 17, 2009
by
Nick Coghlan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid replacing existing modules and sys.path in import tests
parent
8157e19e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
10 deletions
+14
-10
Lib/test/test_imp.py
Lib/test/test_imp.py
+9
-6
Lib/test/test_import.py
Lib/test/test_import.py
+5
-4
No files found.
Lib/test/test_imp.py
View file @
788d7667
...
...
@@ -43,16 +43,19 @@ class ReloadTests(unittest.TestCase):
reload()."""
def
test_source
(
self
):
import
os
imp
.
reload
(
os
)
with
test_support
.
CleanImport
(
'os'
):
import
os
imp
.
reload
(
os
)
def
test_extension
(
self
):
import
time
imp
.
reload
(
time
)
with
test_support
.
CleanImport
(
'time'
):
import
time
imp
.
reload
(
time
)
def
test_builtin
(
self
):
import
marshal
imp
.
reload
(
marshal
)
with
test_support
.
CleanImport
(
'marshal'
):
import
marshal
imp
.
reload
(
marshal
)
def
test_main
():
...
...
Lib/test/test_import.py
View file @
788d7667
...
...
@@ -8,7 +8,7 @@ import py_compile
import
warnings
import
marshal
from
test.test_support
import
(
unlink
,
TESTFN
,
unload
,
run_unittest
,
check_warnings
,
TestFailed
)
check_warnings
,
TestFailed
,
CleanImport
)
def
remove_files
(
name
):
...
...
@@ -122,8 +122,9 @@ class ImportTest(unittest.TestCase):
def
testImpModule
(
self
):
# Verify that the imp module can correctly load and find .py files
import
imp
x
=
imp
.
find_module
(
"os"
)
os
=
imp
.
load_module
(
"os"
,
*
x
)
with
CleanImport
(
"os"
):
x
=
imp
.
find_module
(
"os"
)
os
=
imp
.
load_module
(
"os"
,
*
x
)
def
test_module_with_large_stack
(
self
,
module
=
'longlist'
):
# create module w/list of 65000 elements to test bug #561858
...
...
@@ -361,7 +362,7 @@ class PathsTests(unittest.TestCase):
def
tearDown
(
self
):
shutil
.
rmtree
(
self
.
path
)
sys
.
path
=
self
.
syspath
sys
.
path
[:]
=
self
.
syspath
# http://bugs.python.org/issue1293
def
test_trailing_slash
(
self
):
...
...
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