summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_import.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2001-08-24 18:38:02 (GMT)
committerBarry Warsaw <barry@python.org>2001-08-24 18:38:02 (GMT)
commit1e2775f370538fc216b2ddba6c4f38bee538c560 (patch)
treed7e2824d1f2335bc31593d6f8e5499212a3e1d43 /Lib/test/test_import.py
parent0bcf6d8d5436e9223f795a2040e330f43ebc1ce6 (diff)
downloadcpython-1e2775f370538fc216b2ddba6c4f38bee538c560.zip
cpython-1e2775f370538fc216b2ddba6c4f38bee538c560.tar.gz
cpython-1e2775f370538fc216b2ddba6c4f38bee538c560.tar.bz2
Rip the import repr truncation test out of here and put it in test_repr.py
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r--Lib/test/test_import.py35
1 files changed, 0 insertions, 35 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
index e2fbc5c..b2e3fb6 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -69,38 +69,3 @@ try:
test_with_extension(ext)
finally:
del sys.path[0]
-
-def touch(path):
- fp = open(path, 'w')
- fp.close()
-
-# test imports of packages with really long names, but specifically that their
-# reprs include the full name
-try:
- longname = 'areallylongpackageandmodulenametotestreprtruncation'
- os.mkdir(longname)
- touch(os.path.join(longname, '__init__.py'))
- os.mkdir(os.path.join(longname, longname))
- touch(os.path.join(longname, longname, '__init__.py'))
- touch(os.path.join(longname, longname, longname + '.py'))
- sys.path.insert(0, os.getcwd())
- from areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation import areallylongpackageandmodulenametotestreprtruncation
- if `areallylongpackageandmodulenametotestreprtruncation` <> \
- "<module 'areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation.areallylongpackageandmodulenametotestreprtruncation' from '%s'>" % areallylongpackageandmodulenametotestreprtruncation.__file__:
- raise TestFailed, 'module name truncation'
-finally:
- # Delete recursively
- del sys.path[0]
- def zap(actions, dirname, names):
- for name in names:
- actions.append(os.path.join(dirname, name))
- actions = []
- os.path.walk(longname, zap, actions)
- actions.append(longname)
- actions.sort()
- actions.reverse()
- for p in actions:
- if os.path.isdir(p):
- os.rmdir(p)
- else:
- os.remove(p)