Skip to content

Commit

Permalink
Test chmod and utime
Browse files Browse the repository at this point in the history
  • Loading branch information
netheril96 committed Apr 16, 2024
1 parent 728266f commit ae66d10
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/simple_test.py
Expand Up @@ -608,6 +608,17 @@ def test_read_write_mkdir_listdir_remove(self):
self.assertEqual(st.st_ino, fst.st_ino)
self.assertEqual(st.st_size, fst.st_size)

if sys.platform != "win32":
os.chmod(rng_filename, 0o620)
self.assertEqual(os.lstat(rng_filename).st_mode, 0o100620)

os.utime(rng_filename, times=(1713274809, 1713274821))
self.assertEqual(os.lstat(rng_filename).st_mtime, 1713274821)

now = int(time.time())
os.utime(rng_filename)
self.assertGreaterEqual(os.lstat(rng_filename).st_mtime, now)

data = b"\0" * len(random_data) + b"0"
with open(rng_filename, "wb") as f:
f.write(data)
Expand Down

0 comments on commit ae66d10

Please sign in to comment.