Skip to content

bpo-39460: Disable test_zipfile.test_add_file_after_2107() #18247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 29, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Lib/test/test_zipfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,18 @@ def test_add_file_after_2107(self):
except OverflowError:
self.skipTest('Host fs cannot set timestamp to required value.')

mtime_ns = os.stat(TESTFN).st_mtime_ns
if mtime_ns != (4386268800 * 10**9):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious. Would you consider this better or worse than the 2 lines one?

Suggested change
if mtime_ns != (4386268800 * 10**9):
if (mtime_ns := os.stat(TESTFN).st_mtime_ns) != (4386268800 * 10**9):

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My opinion: I prefer to not use "mtime := ..." here. I like to have an explicitement assignement statement on a separated line ;-)

# XFS filesystem is limited to 32-bit timestamp, but the syscall
# didn't fail. Moreover, there is a VFS bug which returns
# a cached timestamp which is different than the value on disk.
#
# Test st_mtime_ns rather than st_mtime to avoid rounding issues.
#
# https://bugzilla.redhat.com/show_bug.cgi?id=1795576
# https://bugs.python.org/issue39460#msg360952
self.skipTest(f"Linux VFS/XFS kernel bug detected: {mtime_ns=}")

with zipfile.ZipFile(TESTFN2, "w") as zipfp:
self.assertRaises(struct.error, zipfp.write, TESTFN)

Expand Down