Skip to content
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

test_freeze fails if a file is removed #89941

Closed
encukou opened this issue Nov 11, 2021 · 3 comments
Closed

test_freeze fails if a file is removed #89941

encukou opened this issue Nov 11, 2021 · 3 comments
Assignees
Labels
3.11 only security fixes tests Tests in the Lib/test dir

Comments

@encukou
Copy link
Member

encukou commented Nov 11, 2021

BPO 45783
Nosy @encukou, @ericsnowcurrently, @hroncok
PRs
  • bpo-45783: Preserve file moves and deletions in the tests for the freeze tool. #29527
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/ericsnowcurrently'
    closed_at = <Date 2021-11-23.13:44:16.053>
    created_at = <Date 2021-11-11.10:34:54.287>
    labels = ['tests', '3.11']
    title = 'test_freeze fails if a file is removed'
    updated_at = <Date 2021-11-23.13:44:16.053>
    user = 'https://github.com/encukou'

    bugs.python.org fields:

    activity = <Date 2021-11-23.13:44:16.053>
    actor = 'petr.viktorin'
    assignee = 'eric.snow'
    closed = True
    closed_date = <Date 2021-11-23.13:44:16.053>
    closer = 'petr.viktorin'
    components = ['Tests']
    creation = <Date 2021-11-11.10:34:54.287>
    creator = 'petr.viktorin'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 45783
    keywords = ['patch']
    message_count = 3.0
    messages = ['406151', '406164', '406840']
    nosy_count = 3.0
    nosy_names = ['petr.viktorin', 'eric.snow', 'hroncok']
    pr_nums = ['29527']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue45783'
    versions = ['Python 3.11']

    @encukou
    Copy link
    Member Author

    encukou commented Nov 11, 2021

    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/test_freeze.py", line 25, in test_freeze_simple_script
        outdir, scriptfile, python = helper.prepare(script)
                                     ^^^^^^^^^^^^^^^^^^^^^^
      File "/builddir/build/BUILD/Python-3.11.0a2/Tools/freeze/test/freeze.py", line 144, in prepare
        git_copy_repo(srcdir, SRCDIR)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/builddir/build/BUILD/Python-3.11.0a2/Tools/freeze/test/freeze.py", line 97, in git_copy_repo
        shutil.copy2(srcfile, dstfile)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/builddir/build/BUILD/Python-3.11.0a2/Lib/shutil.py", line 436, in copy2
        copyfile(src, dst, follow_symlinks=follow_symlinks)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/builddir/build/BUILD/Python-3.11.0a2/Lib/shutil.py", 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.

    @encukou encukou added the 3.11 only security fixes label Nov 11, 2021
    @ericsnowcurrently
    Copy link
    Member

    Thanks for the report, Petr! I'll take a look.

    @ericsnowcurrently ericsnowcurrently added the tests Tests in the Lib/test dir label Nov 11, 2021
    @ericsnowcurrently ericsnowcurrently self-assigned this Nov 11, 2021
    @encukou
    Copy link
    Member Author

    encukou commented Nov 23, 2021

    New changeset 8ed1495 by Eric Snow in branch 'main':
    bpo-45783: Preserve file moves and deletions in the tests for the freeze tool. (GH-29527)
    8ed1495

    @encukou encukou closed this as completed Nov 23, 2021
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants