[Python-checkins] CVS: python/dist/src/Lib/test test___all__.py,1.12,1.13
Tim Peters
tim_one@users.sourceforge.net
Sun, 11 Feb 2001 19:27:33 -0800
- Previous message: [Python-checkins] CVS: python/dist/src/Lib poplib.py,1.13,1.14 posixfile.py,1.17,1.18 posixpath.py,1.41,1.42 pprint.py,1.11,1.12 pre.py,1.6,1.7 profile.py,1.25,1.26 pstats.py,1.10,1.11 pty.py,1.6,1.7 py_compile.py,1.17,1.18 pyclbr.py,1.18,1.19 quopri.py,1.9,1.10
- Next message: [Python-checkins] CVS: python/dist/src/Lib imputil.py,1.17,1.18
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv21174/python/dist/src/Lib/test
Modified Files:
test___all__.py
Log Message:
test_pty started failing on Windows, but if and only if test___all__ was
run first. Indirectly due to Skip adding check_all("pty") to test___all__:
that caused the expected ImportError due to pty.py trying to import the
non-existent FCNTL to get handled by test___all__, leaving a partial
module object for pty in sys.modules, which caused the later import of
pty via test_pty to succeed. Then test_tpy died with an AttributeError,
due to trying to access attributes of pty that didn't exist. regrtest
viewed that as a failure rather than the appropriate "test skipped".
Fixed by deleting partial module objects in test___all__ when test___all__
handles an ImportError.
Index: test___all__.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** test___all__.py 2001/02/12 02:00:42 1.12
--- test___all__.py 2001/02/12 03:27:31 1.13
***************
*** 7,12 ****
exec "import %s" % modname in names
except ImportError:
! # silent fail here seems the best route since some modules
! # may not be available in all environments
return
verify(hasattr(sys.modules[modname], "__all__"),
--- 7,26 ----
exec "import %s" % modname in names
except ImportError:
! # Silent fail here seems the best route since some modules
! # may not be available in all environments.
! # Since an ImportError may leave a partial module object in
! # sys.modules, get rid of that first. Here's what happens if
! # you don't: importing pty fails on Windows because pty tries to
! # import FCNTL, which doesn't exist. That raises an ImportError,
! # caught here. It also leaves a partial pty module in sys.modules.
! # So when test_pty is called later, the import of pty succeeds,
! # but shouldn't. As a result, test_pty crashes with an
! # AtttributeError instead of an ImportError, and regrtest interprets
! # the latter as a test failure (ImportError is treated as "test
! # skipped" -- which is what test_pty should say on Windows).
! try:
! del sys.modules[modname]
! except KeyError:
! pass
return
verify(hasattr(sys.modules[modname], "__all__"),
- Previous message: [Python-checkins] CVS: python/dist/src/Lib poplib.py,1.13,1.14 posixfile.py,1.17,1.18 posixpath.py,1.41,1.42 pprint.py,1.11,1.12 pre.py,1.6,1.7 profile.py,1.25,1.26 pstats.py,1.10,1.11 pty.py,1.6,1.7 py_compile.py,1.17,1.18 pyclbr.py,1.18,1.19 quopri.py,1.9,1.10
- Next message: [Python-checkins] CVS: python/dist/src/Lib imputil.py,1.17,1.18
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]