8000 Fix filecmp test race condition for mtime. · python/cpython@b775c58 · GitHub
[go: up one dir, main page]

Skip to content

Commit b775c58

Browse files
committed
Fix filecmp test race condition for mtime.
Copy the file stat attributes for the shallow test file. Otherwise it can happen that files compare equal for shallow=True
1 parent 6224a0f commit b775c58

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Lib/test/test_filecmp.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ def setUp(self):
2424
with open(self.name_same_shallow , 'wb') as output:
2525
# same file size; but different content (i.e. all zero)
2626
output.write(bytes(len(data.encode())))
27+
shutil.copystat(self.name_diff, self.name_same_shallow)
28+
2729
self.dir = tempfile.gettempdir()
2830

2931
def tearDown(self):

0 commit comments

Comments
 (0)
0