summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_posix.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_posix.py')
-rw-r--r--Lib/test/test_posix.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
index 3fae2b1..72fdd16 100644
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1125,18 +1125,19 @@ class PosixTester(unittest.TestCase):
"""
Test functions that call path_error2(), providing two filenames in their exceptions.
"""
- for name in ("rename", "replace", "link", "symlink"):
+ for name in ("rename", "replace", "link"):
function = getattr(os, name, None)
+ if function is None:
+ continue
- if function:
- for dst in ("noodly2", support.TESTFN):
- try:
- function('doesnotexistfilename', dst)
- except OSError as e:
- self.assertIn("'doesnotexistfilename' -> '{}'".format(dst), str(e))
- break
- else:
- self.fail("No valid path_error2() test for os." + name)
+ for dst in ("noodly2", support.TESTFN):
+ try:
+ function('doesnotexistfilename', dst)
+ except OSError as e:
+ self.assertIn("'doesnotexistfilename' -> '{}'".format(dst), str(e))
+ break
+ else:
+ self.fail("No valid path_error2() test for os." + name)
class PosixGroupsTester(unittest.TestCase):