summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pathlib.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-11-23 14:59:07 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-11-23 14:59:07 (GMT)
commit5de397e158d538ffa065974006e58547891bd955 (patch)
treedfa6715108e51cb33635bdf23210443f42898b03 /Lib/test/test_pathlib.py
parent4c05b472ddd4634138b6abfa857ee37761d33185 (diff)
parent2cf3917954dab65c025ea39f8b6a0298c598f9f7 (diff)
downloadcpython-5de397e158d538ffa065974006e58547891bd955.zip
cpython-5de397e158d538ffa065974006e58547891bd955.tar.gz
cpython-5de397e158d538ffa065974006e58547891bd955.tar.bz2
merge
Diffstat (limited to 'Lib/test/test_pathlib.py')
-rwxr-xr-xLib/test/test_pathlib.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/Lib/test/test_pathlib.py b/Lib/test/test_pathlib.py
index 6663ffa..4108d5e 100755
--- a/Lib/test/test_pathlib.py
+++ b/Lib/test/test_pathlib.py
@@ -1391,11 +1391,8 @@ class _BasePathTest(object):
# The file mtime should be refreshed by calling touch() again
p.touch()
st = p.stat()
- # Issue #19715: there can be an inconsistency under Windows between
- # the timestamp rounding when creating a file, and the timestamp
- # rounding done when calling utime(). `delta` makes up for this.
- delta = 1e-6 if os.name == 'nt' else 0
- self.assertGreaterEqual(st.st_mtime, old_mtime - delta)
+ self.assertGreaterEqual(st.st_mtime_ns, old_mtime_ns)
+ self.assertGreaterEqual(st.st_mtime, old_mtime)
# Now with exist_ok=False
p = P / 'newfileB'
self.assertFalse(p.exists())
@@ -1403,6 +1400,13 @@ class _BasePathTest(object):
self.assertTrue(p.exists())
self.assertRaises(OSError, p.touch, exist_ok=False)
+ def test_touch_nochange(self):
+ P = self.cls(BASE)
+ p = P / 'fileA'
+ p.touch()
+ with p.open('rb') as f:
+ self.assertEqual(f.read().strip(), b"this is file A")
+
def test_mkdir(self):
P = self.cls(BASE)
p = P / 'newdirA'