summaryrefslogtreecommitdiff
path: root/Lib/test/test_ntpath.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-01-15 03:46:43 +0000
committerFred Drake <fdrake@acm.org>2002-01-15 03:46:43 +0000
commit5e99731ab9e4706b4b06a57e3f429d2447071b4d (patch)
treeb8a82c83e1dca02a8771f7809ce0b28f0f845a63 /Lib/test/test_ntpath.py
parent3d62f8ca35437e478b819a90a3d6ee0629f43fee (diff)
downloadcpython-git-5e99731ab9e4706b4b06a57e3f429d2447071b4d.tar.gz
Only test ntpath.abspath() on Windows. This allows the rest of the module to
be tested regardless of the host platform.
Diffstat (limited to 'Lib/test/test_ntpath.py')
-rw-r--r--Lib/test/test_ntpath.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/Lib/test/test_ntpath.py b/Lib/test/test_ntpath.py
index 336e9e2e7a..4dee1fc00c 100644
--- a/Lib/test/test_ntpath.py
+++ b/Lib/test/test_ntpath.py
@@ -41,8 +41,6 @@ tester('ntpath.isabs("\\\\conky\\mountpoint\\")', 1)
tester('ntpath.isabs("\\foo")', 1)
tester('ntpath.isabs("\\foo\\bar")', 1)
-tester('ntpath.abspath("C:\\")', "C:\\")
-
tester('ntpath.commonprefix(["/home/swenson/spam", "/home/swen/spam"])',
"/home/swen")
tester('ntpath.commonprefix(["\\home\\swen\\spam", "\\home\\swen\\eggs"])',
@@ -108,6 +106,18 @@ tester("ntpath.normpath('c:/../../..')", 'c:\\')
tester("ntpath.normpath('../.././..')", r'..\..\..')
tester("ntpath.normpath('K:../.././..')", r'K:..\..\..')
+# ntpath.abspath() can only be used on a system with the "nt" module
+# (reasonably), so we protect this test with "import nt". This allows
+# the rest of the tests for the ntpath module to be run to completion
+# on any platform, since most of the module is intended to be usable
+# from any platform.
+try:
+ import nt
+except ImportError:
+ pass
+else:
+ tester('ntpath.abspath("C:\\")', "C:\\")
+
if errors:
raise TestFailed(str(errors) + " errors.")
elif verbose: