summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_os.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-12-01 12:53:36 (GMT)
committerGitHub <noreply@github.com>2018-12-01 12:53:36 (GMT)
commit013832ff964a0b3b59e04a07a33bae65c1c3ae84 (patch)
tree83e1529472b688fa58402ab89eff2cd8816f260b /Lib/test/test_os.py
parent1e28daf0b58c9c3a08e98b3a3caebb53acf9a617 (diff)
downloadcpython-013832ff964a0b3b59e04a07a33bae65c1c3ae84.zip
cpython-013832ff964a0b3b59e04a07a33bae65c1c3ae84.tar.gz
cpython-013832ff964a0b3b59e04a07a33bae65c1c3ae84.tar.bz2
bpo-35371: Fix possible crash in os.utime() on Windows. (GH-10844)
(cherry picked from commit 32bc11c33cf5ccea165b5f4ac3799f02fdf9c76a) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/test/test_os.py')
-rw-r--r--Lib/test/test_os.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
index 9e35d55..7a839c8 100644
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -660,6 +660,29 @@ class UtimeTests(unittest.TestCase):
# seconds and nanoseconds parameters are mutually exclusive
with self.assertRaises(ValueError):
os.utime(self.fname, (5, 5), ns=(5, 5))
+ with self.assertRaises(TypeError):
+ os.utime(self.fname, [5, 5])
+ with self.assertRaises(TypeError):
+ os.utime(self.fname, (5,))
+ with self.assertRaises(TypeError):
+ os.utime(self.fname, (5, 5, 5))
+ with self.assertRaises(TypeError):
+ os.utime(self.fname, ns=[5, 5])
+ with self.assertRaises(TypeError):
+ os.utime(self.fname, ns=(5,))
+ with self.assertRaises(TypeError):
+ os.utime(self.fname, ns=(5, 5, 5))
+
+ if os.utime not in os.supports_follow_symlinks:
+ with self.assertRaises(NotImplementedError):
+ os.utime(self.fname, (5, 5), follow_symlinks=False)
+ if os.utime not in os.supports_fd:
+ with open(self.fname, 'wb', 0) as fp:
+ with self.assertRaises(TypeError):
+ os.utime(fp.fileno(), (5, 5))
+ if os.utime not in os.supports_dir_fd:
+ with self.assertRaises(NotImplementedError):
+ os.utime(self.fname, (5, 5), dir_fd=0)
from test import mapping_tests