summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-02-18 11:32:06 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-02-18 11:32:06 (GMT)
commitc8e75ba2c57cd94559dccb9cdb4a420f0c924c9e (patch)
tree83d8f826fd36c4cbe07548ab033eadf1387474d9
parent4676448941b8fbfd941b77f1802d44fddc87e675 (diff)
downloadcpython-c8e75ba2c57cd94559dccb9cdb4a420f0c924c9e.zip
cpython-c8e75ba2c57cd94559dccb9cdb4a420f0c924c9e.tar.gz
cpython-c8e75ba2c57cd94559dccb9cdb4a420f0c924c9e.tar.bz2
Disable posixpath.realpath() tests on Windows (fix for issue #6975).
-rw-r--r--Lib/test/test_posixpath.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_posixpath.py b/Lib/test/test_posixpath.py
index 7443e30..d9867a6 100644
--- a/Lib/test/test_posixpath.py
+++ b/Lib/test/test_posixpath.py
@@ -9,6 +9,16 @@ from posixpath import realpath, abspath, dirname, basename
ABSTFN = abspath(test_support.TESTFN)
+def skip_if_ABSTFN_contains_backslash(test):
+ """
+ On Windows, posixpath.abspath still returns paths with backslashes
+ instead of posix forward slashes. If this is the case, several tests
+ fail, so skip them.
+ """
+ found_backslash = '\\' in ABSTFN
+ msg = "ABSTFN is not a posix path - tests fail"
+ return [test, unittest.skip(msg)(test)][found_backslash]
+
def safe_rmdir(dirname):
try:
os.rmdir(dirname)
@@ -214,11 +224,13 @@ class PosixPathTest(unittest.TestCase):
self.assertEqual(posixpath.normpath("///foo/.//bar//.//..//.//baz"), "/foo/baz")
self.assertEqual(posixpath.normpath("///..//./foo/.//bar"), "/foo/bar")
+ @skip_if_ABSTFN_contains_backslash
def test_realpath_curdir(self):
self.assertEqual(realpath('.'), os.getcwd())
self.assertEqual(realpath('./.'), os.getcwd())
self.assertEqual(realpath('/'.join(['.'] * 100)), os.getcwd())
+ @skip_if_ABSTFN_contains_backslash
def test_realpath_pardir(self):
self.assertEqual(realpath('..'), dirname(os.getcwd()))
self.assertEqual(realpath('../..'), dirname(dirname(os.getcwd())))