[pypy-commit] pypy py3.5: fix tests, remaining test_rename failure succeeds on cpython3

mattip pypy.commits at gmail.com
Sat Mar 10 17:21:58 EST 2018


Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.5
Changeset: r93967:19f63e72f7ce
Date: 2018-03-11 00:09 +0200
http://bitbucket.org/pypy/pypy/changeset/19f63e72f7ce/

Log:	fix tests, remaining test_rename failure succeeds on cpython3

diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -1087,12 +1087,11 @@
             if sys.platform == 'win32':
                 os.chmod(my_path, 0o400)
                 assert (os.stat(my_path).st_mode & 0o600) == 0o400
-                os.chmod(self.path, 0700)
+                os.chmod(self.path, 0o700)
             else:
                 os.chmod(my_path, 0o200)
                 assert (os.stat(my_path).st_mode & 0o777) == 0o200
-                os.chmod(self.path, 0700)
-            os.unlink(self.path)
+                os.chmod(self.path, 0o700)
 
     if hasattr(os, 'fchmod'):
         def test_fchmod(self):
@@ -1103,7 +1102,6 @@
             assert (os.fstat(f.fileno()).st_mode & 0o777) == 0o200
             f.close()
             assert (os.stat(my_path).st_mode & 0o777) == 0o200
-            os.unlink(self.path)
 
     if hasattr(os, 'mkfifo'):
         def test_mkfifo(self):
@@ -1407,16 +1405,17 @@
 
     def test_rename(self):
         os = self.posix
-        with open(self.path, "w") as f:
+        fname = self.path2 + 'rename.txt'
+        with open(fname, "w") as f:
             f.write("this is a rename test")
         unicode_name = str(self.udir) + u'/test\u03be.txt'
-        os.rename(self.path, unicode_name)
+        os.rename(fname, unicode_name)
         with open(unicode_name) as f:
             assert f.read() == 'this is a rename test'
-        os.rename(unicode_name, self.path)
-        with open(self.path) as f:
+        os.rename(unicode_name, fname)
+        with open(fname) as f:
             assert f.read() == 'this is a rename test'
-        os.unlink(self.path)
+        os.unlink(fname)
 
         
     def test_device_encoding(self):


More information about the pypy-commit mailing list