[Python-checkins] cpython (3.4): cleanup test_posix

victor.stinner python-checkins at python.org
Sun Oct 5 17:39:07 CEST 2014


https://hg.python.org/cpython/rev/ae031e239767
changeset:   92824:ae031e239767
branch:      3.4
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sun Oct 05 17:37:59 2014 +0200
summary:
  cleanup test_posix

files:
  Lib/test/test_posix.py |  19 ++++++++++---------
  1 files changed, 10 insertions(+), 9 deletions(-)


diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py
--- a/Lib/test/test_posix.py
+++ b/Lib/test/test_posix.py
@@ -1127,16 +1127,17 @@
         """
         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):
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list