From bed04a77ee4dde8e1ab7b00557519f01cac734aa Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sun, 5 Oct 2014 17:37:59 +0200 Subject: [PATCH] cleanup test_posix --- Lib/test/test_posix.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index a269db4b32..72fdd16f8d 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -1127,16 +1127,17 @@ class PosixTester(unittest.TestCase): """ 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): -- 2.40.0