This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: test_freeze fails if a file is removed
Type: Stage: resolved
Components: Tests Versions: Python 3.11
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.snow Nosy List: eric.snow, hroncok, petr.viktorin
Priority: normal Keywords: patch

Created on 2021-11-11 10:34 by petr.viktorin, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 29527 merged eric.snow, 2021-11-11 21:08
Messages (3)
msg406151 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-11-11 10:34
In Fedora, we remove the bundled wheels; pip & co. are supplied (and kept updated) by the system. I believe this is good practice.

However, removing any file from the CPython source checkout makes test_freeze fail:

Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.11.0a2/Lib/test/test_tools/", line 25, in test_freeze_simple_script
    outdir, scriptfile, python = helper.prepare(script)
  File "/builddir/build/BUILD/Python-3.11.0a2/Tools/freeze/test/", line 144, in prepare
    git_copy_repo(srcdir, SRCDIR)
  File "/builddir/build/BUILD/Python-3.11.0a2/Tools/freeze/test/", line 97, in git_copy_repo
    shutil.copy2(srcfile, dstfile)
  File "/builddir/build/BUILD/Python-3.11.0a2/Lib/", line 436, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/builddir/build/BUILD/Python-3.11.0a2/Lib/", line 256, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/builddir/build/BUILD/Python-3.11.0a2/Lib/ensurepip/_bundled/pip-21.2.4-py3-none-any.whl'

It looks like this test is recreating uncommited modifications, is it OK to change it to support deletions as well?
Also, `git status --porcelain` should be used to get the output in a stable format.
msg406164 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2021-11-11 16:21
Thanks for the report, Petr!  I'll take a look.
msg406840 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-11-23 13:43
New changeset 8ed1495ad900dd815ff8fb97926da5312aaa23f9 by Eric Snow in branch 'main':
bpo-45783: Preserve file moves and deletions in the tests for the freeze tool. (GH-29527)
Date User Action Args
2022-04-11 14:59:52adminsetgithub: 89941
2021-11-23 13:44:16petr.viktorinsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-11-23 13:43:51petr.viktorinsetmessages: + msg406840
2021-11-11 21:08:01eric.snowsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request27777
2021-11-11 16:21:03eric.snowsetassignee: eric.snow
messages: + msg406164
components: + Tests
stage: needs patch
2021-11-11 14:32:43hroncoksetnosy: + hroncok
2021-11-11 10:34:54petr.viktorincreate