File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -40,17 +40,14 @@ def get_mtime(fname):
4040 :param fname: File name
4141 :return: The last time the file was modified.
4242 """
43+ p = Path (fname )
4344 try :
44- target = Path (fname )
45- mtime = target .stat ().st_mtime
46- # mtime = os.stat(fname).st_mtime_ns
45+ mtime = p .stat ().st_mtime
4746 except OSError :
48- # The file might be right in the middle of being written to
47+ # The file might be right in the middle of being created
4948 # so sleep
5049 time .sleep (1 )
51- target = Path (fname )
52- mtime = target .stat ().st_mtime
53- # mtime = os.stat(fname).st_mtime_ns
50+ mtime = p .stat ().st_mtime
5451
5552 return mtime
5653
Original file line number Diff line number Diff line change 11import os
2+ from time import sleep
23
34from idpyoidc .storage .listfile import ReadOnlyListFile
45
@@ -22,6 +23,7 @@ def test_read_only_list_file():
2223 for line in ["one" , "two" , "three" ]:
2324 fp .write (line + '\n ' )
2425
26+ sleep (1 )
2527 assert len (_read_only ) == 3
2628 assert set (_read_only ) == {"one" , "two" , "three" }
2729 assert _read_only [- 1 ] == "three"
You can’t perform that action at this time.
0 commit comments