[Python-checkins] CVS: python/dist/src/Lib/test test_import.py,1.8,1.9
Barry Warsaw
bwarsaw@users.sourceforge.net
Fri, 24 Aug 2001 11:38:04 -0700
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv15032/Lib/test
Modified Files:
test_import.py
Log Message:
Rip the import repr truncation test out of here and put it in test_repr.py
Index: test_import.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_import.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** test_import.py 2001/08/16 20:42:38 1.8
--- test_import.py 2001/08/24 18:38:02 1.9
***************
*** 70,106 ****
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)
--- 70,71 ----