Skip to content

Commit 6e726c3

Browse files
authored
Add short sleeps to make ls test deterministic (#209)
* Add short sleeps to make ls test deterministic * lint
1 parent f3fae1e commit 6e726c3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

python/tests/test_cli.py

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
import re
66
import stat
7+
import time
78
from datetime import datetime
89
from tempfile import TemporaryDirectory
910
from typing import Callable, Iterator, List, Literal, Optional, Tuple, overload
@@ -268,10 +269,15 @@ def parse_output(output: str) -> Iterator[Tuple[int, List[FileOutput]]]:
268269
with client.create("/testfile1") as f:
269270
f.write(bytes(range(10)))
270271

272+
# Make sure we wait a few milliseconds so we don't get the exact same timestamp
273+
time.sleep(0.01)
274+
271275
with client.create("/testfile2") as f:
272276
for i in range(1024):
273277
f.write(i.to_bytes(4, "big"))
274278

279+
time.sleep(0.01)
280+
275281
client.mkdirs("/testdir")
276282

277283
directory = FileOutput("drwxr-xr-x", "-", "0", "/testdir")

0 commit comments

Comments
 (0)