Skip to content

test_makefile_test_folders fails if test/wheeldata is empty #117711

Closed

Description

@befeleme

Bug report

Bug description:

In Fedora, when packaging Python, we remove the .whl files from Lib/test/wheeldata/. The directory is left empty.
test_makefile has started to skip empty directories as of alpha 6 (#117190). It doesn't include them in the list of used which are then checked for equality with unique_test_dirs. This causes the test to fail in our environment.

The test could be more robust and account for sysconfig.get_config_var('WHEEL_PKG_DIR'). If this is present, then it shouldn't expect that test/wheeldata is among the tested directories. (#105056)

Traceback for completness:

test_makefile_test_folders (test.test_tools.test_makefile.TestMakefile.test_makefile_test_folders) ... FAIL

======================================================================
FAIL: test_makefile_test_folders (test.test_tools.test_makefile.TestMakefile.test_makefile_test_folders)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.13.0a6/Lib/test/test_tools/test_makefile.py", line 72, in test_makefile_test_folders
    self.assertSetEqual(unique_test_dirs, set(used))
    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Items in the first set but not the second:
'test/wheeldata'

----------------------------------------------------------------------
Ran 1 test in 0.033s

FAILED (failures=1)

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    testsTests in the Lib/test dir
    3.13only security fixes
    on Apr 10, 2024
  2. befeleme commented on Apr 10, 2024

    @befeleme
    ContributorAuthor

    The upstream change has been also backported to Python 3.12 and affects Fedora's builds of this version too.

  3. corona10 commented on Apr 10, 2024

    @corona10
    Member
  4. terryjreedy commented on Apr 10, 2024

    @terryjreedy
    Member

    One solution is for you to not remove the two files. Why remove them? Given that you remove them, why leave the empty directory to cause a failure? Does anything else break if you remove it also?

  5. added a commit that references this issue on Apr 11, 2024
  6. befeleme commented on Apr 11, 2024

    @befeleme
    ContributorAuthor

    We ship the Python tests in Fedora, so we don't want to include wheels that are not actually used when building and testing our Python version, also removing the files "makes sure" they're really really not used.
    Removing the directory is an option, but that would require us to patch Makefile.pre.in (https://github.com/python/cpython/blob/main/Makefile.pre.in#L2473) which lists the folder in TESTSUBDIRS which are then expected in the output.
    Given all that, we'd prefer to patch the test rather than the other places.

  7. vstinner commented on Apr 11, 2024

    @vstinner
    Member

    I created PR gh-117748 to fix the issue.

  8. added a commit that references this issue on Apr 11, 2024
  9. vstinner commented on Apr 11, 2024

    @vstinner
    Member

    Fixed by change d496387.

    I created PR #117748 to fix the issue.

    Oh, I didn't notice that @befeleme wrote a PR. I merged her PR, IMO her approach is better.

  10. befeleme commented on Apr 11, 2024

    @befeleme
    ContributorAuthor

    Thank you!

  11. added a commit that references this issue on Apr 11, 2024
  12. added a commit that references this issue on Apr 11, 2024
  13. added a commit that references this issue on Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13only security fixestestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions