Kaydet (Commit) 68854fdc authored tarafından R David Murray's avatar R David Murray

#2466: fix test failure on windows.

Windows symlink support was introduced in python3, so we need to skip
those tests differently on python2.  Patch by Xiang Zhang.
üst 85783166
import unittest import unittest
from test import symlink_support
from test import test_support, test_genericpath from test import test_support, test_genericpath
from test import test_support as support from test import test_support as support
...@@ -106,7 +105,7 @@ class PosixPathTest(unittest.TestCase): ...@@ -106,7 +105,7 @@ class PosixPathTest(unittest.TestCase):
f.write("foo") f.write("foo")
f.close() f.close()
self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False) self.assertIs(posixpath.islink(test_support.TESTFN + "1"), False)
if symlink_support.can_symlink(): if hasattr(os, 'symlink'):
os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2") os.symlink(test_support.TESTFN + "1", test_support.TESTFN + "2")
self.assertIs(posixpath.islink(test_support.TESTFN + "2"), True) self.assertIs(posixpath.islink(test_support.TESTFN + "2"), True)
os.remove(test_support.TESTFN + "1") os.remove(test_support.TESTFN + "1")
...@@ -211,7 +210,8 @@ class PosixPathTest(unittest.TestCase): ...@@ -211,7 +210,8 @@ class PosixPathTest(unittest.TestCase):
finally: finally:
safe_rmdir(ABSTFN) safe_rmdir(ABSTFN)
@symlink_support.skip_unless_symlink @unittest.skipUnless(hasattr(os, 'symlink'),
'Requires functional symlink implementation')
def test_ismount_symlinks(self): def test_ismount_symlinks(self):
# Symlinks are never mountpoints. # Symlinks are never mountpoints.
try: try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment