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_makefile_test_folders fails if test/wheeldata is empty #117711

Closed
befeleme opened this issue Apr 10, 2024 · 7 comments
Closed

test_makefile_test_folders fails if test/wheeldata is empty #117711

befeleme opened this issue Apr 10, 2024 · 7 comments
Labels
3.13 new features, bugs and security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@befeleme
Copy link
Contributor

befeleme commented Apr 10, 2024

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

@befeleme befeleme added the type-bug An unexpected behavior, bug, or error label Apr 10, 2024
@hugovk hugovk added tests Tests in the Lib/test dir 3.13 new features, bugs and security fixes labels Apr 10, 2024
@befeleme
Copy link
Contributor Author

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

@corona10
Copy link
Member

cc @vstinner

@terryjreedy
Copy link
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?

@befeleme
Copy link
Contributor Author

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.

@vstinner
Copy link
Member

I created PR gh-117748 to fix the issue.

vstinner pushed a commit that referenced this issue Apr 11, 2024
…117712)

It's possible to build Python with option `--with-wheel-pkg-dir`
pointing to a custom wheel directory. Don't include the directory in the test
set if the wheels are used from a different location.

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
@vstinner
Copy link
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.

@befeleme
Copy link
Contributor Author

Thank you!

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Apr 11, 2024
…sed (pythonGH-117712)

It's possible to build Python with option `--with-wheel-pkg-dir`
pointing to a custom wheel directory. Don't include the directory in the test
set if the wheels are used from a different location.

(cherry picked from commit d496387)

Co-authored-by: Karolina Surma <33810531+befeleme@users.noreply.github.com>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
vstinner pushed a commit that referenced this issue Apr 11, 2024
…used (GH-117712) (#117749)

gh-117711: Only check for 'test/wheeldata' when it's actually used (GH-117712)

It's possible to build Python with option `--with-wheel-pkg-dir`
pointing to a custom wheel directory. Don't include the directory in the test
set if the wheels are used from a different location.

(cherry picked from commit d496387)

Co-authored-by: Karolina Surma <33810531+befeleme@users.noreply.github.com>
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024
…sed (python#117712)

It's possible to build Python with option `--with-wheel-pkg-dir`
pointing to a custom wheel directory. Don't include the directory in the test
set if the wheels are used from a different location.

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 new features, bugs and security fixes tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

5 participants