Author: Ronan Lamy <[email protected]>
Branch: follow_symlinks
Changeset: r83327:57c933e9ad24
Date: 2016-03-25 00:48 +0000
http://bitbucket.org/pypy/pypy/changeset/57c933e9ad24/

Log:    Add test for symlink(.., dir_fd=...)

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
@@ -993,6 +993,19 @@
                 data = f.read()
                 assert data == "who cares?"
 
+        # XXX skip test if dir_fd is unsupported
+        def test_symlink_fd(self):
+            posix = self.posix
+            bytes_dir = self.bytes_dir
+            f = posix.open(bytes_dir, posix.O_RDONLY)
+            try:
+                posix.symlink('somefile', 'somelink', dir_fd=f)
+                assert (posix.readlink(bytes_dir + '/somelink'.encode()) ==
+                        'somefile'.encode())
+            finally:
+                posix.close(f)
+                posix.unlink(bytes_dir + '/somelink'.encode())
+
     if hasattr(os, 'ftruncate'):
         def test_truncate(self):
             posix = self.posix
@@ -1281,6 +1294,7 @@
         if os.name == 'posix':
             assert os.open in os.supports_dir_fd  # openat()
 
+
 def test_convert_seconds_simple(space):
     w_time = space.wrap(123.456)
     assert convert_seconds(space, w_time) == (123, 456000000)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to