Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bed04a7

Browse files
committed
cleanup test_posix
1 parent 047b7ae commit bed04a7

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

Lib/test/test_posix.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,16 +1127,17 @@ def test_path_error2(self):
11271127
"""
11281128
for name in ("rename", "replace", "link"):
11291129
function = getattr(os, name, None)
1130+
if function is None:
1131+
continue
11301132

1131-
if function:
1132-
for dst in ("noodly2", support.TESTFN):
1133-
try:
1134-
function('doesnotexistfilename', dst)
1135-
except OSError as e:
1136-
self.assertIn("'doesnotexistfilename' -> '{}'".format(dst), str(e))
1137-
break
1138-
else:
1139-
self.fail("No valid path_error2() test for os." + name)
1133+
for dst in ("noodly2", support.TESTFN):
1134+
try:
1135+
function('doesnotexistfilename', dst)
1136+
except OSError as e:
1137+
self.assertIn("'doesnotexistfilename' -> '{}'".format(dst), str(e))
1138+
break
1139+
else:
1140+
self.fail("No valid path_error2() test for os." + name)
11401141

11411142
class PosixGroupsTester(unittest.TestCase):
11421143

0 commit comments

Comments
 (0)