GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test_zipfile can fail if SOURCE_DATE_EPOCH is set · Issue #154948 · python/cpython

test_zipfile can fail if SOURCE_DATE_EPOCH is set #154948

New issue
Copy link
New issue
Copy link
Closed
Closed
test_zipfile can fail if SOURCE_DATE_EPOCH is set#154948
Copy link
Assignees
StanFromIreland
Labels
testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@stefanor
stefanor
opened on Jul 30, 2026
Issue body actions

Bug report

Bug description:

It is common to build Python with SOURCE_DATE_EPOCH set to some stable timestamp, allowing the Python build to be reproduced later (by setting the same timestamp). It's also common to run the Python test suite when you build Python.

In GH-152831, I set SOURCE_DATE_EPOCH, so that multiple builds of Python would be as similar as possible. But setting this before running the Python test suite breaks test_zipfile.

It's probably OK for test_zipfile to skip tests in this scenario, but if its the test we run in GitHub CI, that's probably not OK. For now, I have no other reason to set it.

$ SOURCE_DATE_EPOCH=1785326513 ./python -m test test_zipfile
...
======================================================================
FAIL: test_repack_removed_bytes_between_files (test.test_zipfile.test_core.ZstdRepackTests.test_repack_removed_bytes_between_files) (removed=[2])
Should not remove bytes between local file entries.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/stefanor/git/upstream/cpython/Lib/test/test_zipfile/test_core.py", line 2282, in test_repack_removed_bytes_between_files
    self.assertEqual(
    ~~~~~~~~~~~~~~~~^
        [comparable_zinfo(zi) for zi in zh.infolist()],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        [comparable_zinfo(zi) for zi in expected_zinfos],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
AssertionError: Lists differ: [{'or[82 chars] 1, 52), 'compress_type': 93, 'compress_level'[678 chars] 62}] != [{'or[82 chars] 1, 53), 'compress_type': 93, 'compress_level'[678 chars] 62}]

First differing element 0:
{'ori[81 chars] 1, 52), 'compress_type': 93, 'compress_level'[268 chars]: 55}
{'ori[81 chars] 1, 53), 'compress_type': 93, 'compress_level'[268 chars]: 55}

  [{'CRC': 1821039217,
    'comment': b'',
    'compress_level': None,
    'compress_size': 64,
    'compress_type': 93,
    'create_system': 3,
    'create_version': 63,
-   'date_time': (2026, 7, 29, 12, 1, 52),
?                                      ^

+   'date_time': (2026, 7, 29, 12, 1, 53),
?                                      ^

    'external_attr': 25165824,
    'extra': b'',
    'extract_version': 63,
    'file_size': 55,
    'filename': 'file0.txt',
    'flag_bits': 2048,
    'header_offset': 0,
    'internal_attr': 0,
    'orig_filename': 'file0.txt',
    'reserved': 0,
    'volume': 0},
   {'CRC': 2493679103,
    'comment': b'',
    'compress_level': None,
    'compress_size': 71,
    'compress_type': 93,
    'create_system': 3,
    'create_version': 63,
-   'date_time': (2026, 7, 29, 12, 1, 52),
?                                      ^

+   'date_time': (2026, 7, 29, 12, 1, 53),
?                                      ^

    'external_attr': 25165824,
    'extra': b'',
    'extract_version': 63,
    'file_size': 62,
    'filename': 'file1.txt',
    'flag_bits': 2048,
    'header_offset': 116,
    'internal_attr': 0,
    'orig_filename': 'file1.txt',
    'reserved': 0,
    'volume': 0}]

----------------------------------------------------------------------
Ran 589 tests in 10.300s

FAILED (failures=50, skipped=3)

(I skipped 49 similar failures in the output)

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

  • gh-154948: Fix test_zipfile failure when SOURCE_DATE_EPOCH is set #155001
  • [3.15] gh-154948: Fix test_zipfile failure when SOURCE_DATE_EPOCH is set (GH-155001) #155347

Activity

  1. stefanor
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jul 30, 2026
  2. StanFromIreland
    added
    testsTests in the Lib/test dirTests in the Lib/test dir
    on Jul 30, 2026
  3. StanFromIreland
    added this to Zipfile issues 📦on Jul 30, 2026
  4. yassinbahri commented on Jul 31, 2026

    @yassinbahri
    yassinbahri
    on Jul 31, 2026
    More actions

    can I work on this?

  5. StanFromIreland
    self-assigned this
    on Jul 31, 2026
  6. StanFromIreland
    added a commit that references this issue on Aug 7, 2026

    gh-154948: Fix `test_zipfile` failure when `SOURCE_DATE_EPOCH` is set (…

    82905dd
  7. hugovk
    added a commit that references this issue on Aug 7, 2026

    [3.15] gh-154948: Fix `test_zipfile` failure when `SOURCE_DATE_EPOCH`…

    c56ce5a
  8. hugovk
    closed this as completedon Aug 7, 2026
  9. github-project-automation
    moved this to Done in Zipfile issues 📦on Aug 7, 2026
  10. stefanor
    added 2 commits that reference this issue on Aug 7, 2026

    Set SOURCE_DATE_EPOCH again (now that pythonGH-154948 is fixed)

    3cb0048

    Set SOURCE_DATE_EPOCH again (now that pythonGH-154948 is fixed)

    065ab4c
  11. mbeijen
    added a commit that references this issue on Aug 14, 2026

    pythongh-154948: Fix `test_zipfile` failure when `SOURCE_DATE_EPOCH` …

    acc625f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @StanFromIreland
    StanFromIreland

Labels

testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

  • Zipfile issues 📦
    Status
    Done
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.