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

5.4.0: pytest fails because missing test.support #6

Closed
kloczek opened this issue Mar 21, 2024 · 10 comments
Closed

5.4.0: pytest fails because missing test.support #6

kloczek opened this issue Mar 21, 2024 · 10 comments

Comments

@kloczek
Copy link

kloczek commented Mar 21, 2024

I'm not sure but on first look looks lik eon file is missing in tests/

+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.9.18, pytest-8.1.1, pluggy-1.4.0
rootdir: /home/tkloczko/rpmbuild/BUILD/jaraco.test-5.4.0
configfile: pytest.ini
plugins: jaraco.test-5.4.0
collected 5 items / 1 deselected / 4 selected

jaraco/test/__init__.py .                                                [ 25%]
jaraco/test/cpython.py FF                                                [ 75%]
tests/test_http.py .                                                     [100%]

=================================== FAILURES ===================================
____________________________ [doctest] test.cpython ____________________________
001
002 Compatibility shims for getting stuff from test.support across
003 Python versions (for compatibility with Python 3.9 and earlier).
004
005 >>> os_helper = try_import('os_helper') or from_test_support('temp_dir')
UNEXPECTED EXCEPTION: ModuleNotFoundError("No module named 'test.support'")
Traceback (most recent call last):
  File "/usr/lib64/python3.9/doctest.py", line 1334, in __run
    exec(compile(example.source, filename, "single",
  File "<doctest test.cpython[0]>", line 1, in <module>
  File "/home/tkloczko/rpmbuild/BUILD/jaraco.test-5.4.0/jaraco/test/cpython.py", line 25, in from_test_support
    import test.support
ModuleNotFoundError: No module named 'test.support'
/home/tkloczko/rpmbuild/BUILD/jaraco.test-5.4.0/jaraco/test/cpython.py:5: UnexpectedException
___________________ [doctest] test.cpython.from_test_support ___________________
018
019     Return a SimpleNamespace of names from test.support.
020
021     >>> support = from_test_support('swap_item')
UNEXPECTED EXCEPTION: ModuleNotFoundError("No module named 'test.support'")
Traceback (most recent call last):
  File "/usr/lib64/python3.9/doctest.py", line 1334, in __run
    exec(compile(example.source, filename, "single",
  File "<doctest test.cpython.from_test_support[0]>", line 1, in <module>
  File "/home/tkloczko/rpmbuild/BUILD/jaraco.test-5.4.0/jaraco/test/cpython.py", line 25, in from_test_support
    import test.support
ModuleNotFoundError: No module named 'test.support'
/home/tkloczko/rpmbuild/BUILD/jaraco.test-5.4.0/jaraco/test/cpython.py:21: UnexpectedException
=========================== short test summary info ============================
FAILED jaraco/test/cpython.py::test.cpython
FAILED jaraco/test/cpython.py::test.cpython.from_test_support
================== 2 failed, 2 passed, 1 deselected in 0.14s ===================
@kloczek
Copy link
Author

kloczek commented Mar 21, 2024

And other small issue is as well here that new/temporary directory added begore start build are breaking build (missing some bits in pyproject.toml)

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting build dependencies for wheel...
error: Multiple top-level packages discovered in a flat-layout: ['jaraco', 'SPECPARTS'].

To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.

If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:

1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names

To find more information, look for "package discovery" on setuptools docs.

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel

@kloczek
Copy link
Author

kloczek commented Apr 9, 2024

Gentle ping .. any update?
Could you please at least confirm that test suite is not in useable state? 🤔

@mweinelt
Copy link

We experience the same issue on nixpkgs, and importlib-resources 6.4.0 now relies on jaraco.test.cython, exhibiting the same problem.

@stanislavlevin
Copy link

@s-t-e-v-e-n-k
Copy link

Ah ha, but test.support is provided by Python itself, and isn't missing, but pytest insists it isn't there:

> python3.10
Python 3.10.14 (main, Mar 21 2024, 16:45:28) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import test.support
>>> test.support.__file__
'/usr/lib64/python3.10/test/support/__init__.py'

And under pytest:

[   10s] Traceback (most recent call last):
[   10s]   File "/usr/lib64/python3.10/doctest.py", line 1350, in __run
[   10s]     exec(compile(example.source, filename, "single",
[   10s]   File "<doctest test.cpython[0]>", line 1, in <module>
[   10s]   File "/home/abuild/rpmbuild/BUILD/jaraco.test-5.4.0/jaraco/test/cpython.py", line 25, in from_test_support
[   10s]     import test.support
[   10s] ModuleNotFoundError: No module named 'test.support'

I've bisected this down to being introduced by pytest commit c85fce39b60a6cc3537e9da3e7a4f4946cfe4d49

@frenzymadness
Copy link

It seems the problem is fixed by: 40a16ec

It works fine for me now with pytest 8.2.0 and also the latest 8.3.2. A new release would be nice.

@s-t-e-v-e-n-k
Copy link

Chasing down the pytest commit that fixes this, which I think is pytest-dev/pytest#12208 , we may have to wait until pytest 8.4.0 is released.

@LecrisUT
Copy link
Contributor

LecrisUT commented Aug 12, 2024

Anyone have ideas why this is also occurring in pytest 6.2.2? According to the bisect it would only be in pytest >= 8.1.0

https://download.copr.fedorainfracloud.org/results/packit/LecrisUT-importlib-resources-rpmspec-epel9/epel-9-x86_64/07895716-python-jaraco-test/builder-live.log.gz

I have tried 40a16ec, but for pytest 6.2.2 I get:

PytestConfigWarning: Unknown config option: consider_namespace_packages

@jaraco
Copy link
Owner

jaraco commented Sep 17, 2024

Apologies for the radio silence. I only visit my projects incidentally and don't subscribe to email notifications for filed issues, so feel free to ping me if something is languishing that needs my attention.

And other small issue is as well here that new/temporary directory added begore start build are breaking build (missing some bits in pyproject.toml)

This issue is being tracked in jaraco/skeleton#116.

Could you please at least confirm that test suite is not in useable state? 🤔

The test suite is usable. It's very rare that I'll release one of my projects if the tests aren't passing in CI.

It seems the problem is fixed by: 40a16ec

It works fine for me now with pytest 8.2.0 and also the latest 8.3.2. A new release would be nice.

A new release is cut (v5.5.0). Let me know if that doesn't at least work around this issue.

@jaraco jaraco closed this as completed Sep 17, 2024
@jaraco
Copy link
Owner

jaraco commented Sep 17, 2024

Anyone have ideas why this is also occurring in pytest 6.2.2? According to the bisect it would only be in pytest >= 8.1.0

I've lost track, but there were lots of changes around module discovery in 8.0, 8.1, and 8.2, so I'd not be surprised if some or all projects are actually now reliant on pytest 8.x or even 8.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants