summaryrefslogtreecommitdiff
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
authorMartin Panter <vadmium>2015-09-09 03:01:17 +0000
committerMartin Panter <vadmium>2015-09-09 03:01:17 +0000
commita122b5a1fdecb8b131e1773a30e94021f32a90bc (patch)
tree69211f5815d460bc991ee6df2cb8f0aa8fbc1c3f /Lib/test/test_os.py
parent9b82a99a64d3ef9ffd407e69be92a14ad482a925 (diff)
parent5127cdea054eba8d1f7631f050f3a91cc01b6542 (diff)
downloadcpython-git-a122b5a1fdecb8b131e1773a30e94021f32a90bc.tar.gz
Issue #23738: Merge 3.5 into 3.6
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index b3cf2072c3..15040c3639 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -85,7 +85,7 @@ HAVE_WHEEL_GROUP = sys.platform.startswith('freebsd') and os.getgid() == 0
# Tests creating TESTFN
class FileTests(unittest.TestCase):
def setUp(self):
- if os.path.exists(support.TESTFN):
+ if os.path.lexists(support.TESTFN):
os.unlink(support.TESTFN)
tearDown = setUp
@@ -209,6 +209,19 @@ class FileTests(unittest.TestCase):
with open(TESTFN2, 'r') as f:
self.assertEqual(f.read(), "1")
+ def test_open_keywords(self):
+ f = os.open(path=__file__, flags=os.O_RDONLY, mode=0o777,
+ dir_fd=None)
+ os.close(f)
+
+ def test_symlink_keywords(self):
+ symlink = support.get_attribute(os, "symlink")
+ try:
+ symlink(src='target', dst=support.TESTFN,
+ target_is_directory=False, dir_fd=None)
+ except (NotImplementedError, OSError):
+ pass # No OS support or unprivileged user
+
# Test attributes on return values from os.*stat* family.
class StatAttributeTests(unittest.TestCase):
@@ -2312,6 +2325,14 @@ class TestSendfile(unittest.TestCase):
os.sendfile(self.sockno, self.fileno, -1, 4096)
self.assertEqual(cm.exception.errno, errno.EINVAL)
+ def test_keywords(self):
+ # Keyword arguments should be supported
+ os.sendfile(out=self.sockno, offset=0, count=4096,
+ **{'in': self.fileno})
+ if self.SUPPORT_HEADERS_TRAILERS:
+ os.sendfile(self.sockno, self.fileno, offset=0, count=4096,
+ headers=None, trailers=None, flags=0)
+
# --- headers / trailers tests
@requires_headers_trailers