[Python-Dev] guidance sought: merging port related changes to Library modules

Fred L. Drake, Jr. fdrake@acm.org
Mon, 14 Jan 2002 09:25:46 -0500 (EST)


Guido van Rossum writes:
 > The various modules ntpath, posixpath, macpath etc. are not just their
 > to support their own platform on itself.  They are also there to

Note that ntpath.abspath() relies on nt._getfullpathname().  It is not
unreasonable for this particular function to require that it actually
be running on NT, so I'm not going to suggest changing this.  On the
other hand, it means the portable portions of the module are (mostly)
not tested when the regression test is run on a platform other than
Windows; the ntpath.abspath() test raises an ImportError since
ntpath.abspath() imports the "nt" module within the function, and the
resulting ImportError causes the rest of the unit test to be skipped
and regrtest.py reports that the test is skipped.

I'd like to change the test so that the abspath() test is only run
if the "nt" module is available:

try:
    import nt
except ImportError:
    pass
else:
    tester('ntpath.abspath("C:\\")', "C:\\")

Any objections?


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation