-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
Lately I have been reviewing a bunch of jaraco.* packages in Fedora, and every now-and-then I get issues with running the tests where the non-src-layout interferes with /usr/bin/pytest calls. Sometimes I work around it by changing the --import-mode prepend, sometimes I have to run python3 -m pytest.
One recent example was in jaraco.packaging where it errors as:
Details
__________________ [doctest] packaging.metadata.hunt_down_url __________________
019
020 Given project metadata, figure out what the package URL is.
021
022 >>> hunt_down_url(load('.'))
UNEXPECTED EXCEPTION: ModuleNotFoundError("No module named 'packaging.version'")
Traceback (most recent call last):
File "/usr/lib64/python3.13/doctest.py", line 1395, in __run
exec(compile(example.source, filename, "single",
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
compileflags, True), test.globs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<doctest packaging.metadata.hunt_down_url[0]>", line 1, in <module>
File "/builddir/build/BUILD/python-jaraco-packaging-10.2.2-build/jaraco_packaging-10.2.2/jaraco/packaging/metadata.py", line 15, in load
return util.project_wheel_metadata(source_dir, isolated, **kwargs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/build/util.py", line 42, in project_wheel_metadata
with DefaultIsolatedEnv() as env:
~~~~~~~~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/build/env.py", line 90, in __enter__
self._env_backend = _PipBackend()
~~~~~~~~~~~^^
File "/usr/lib/python3.13/site-packages/build/env.py", line 153, in __init__
self._create_with_virtualenv = not self._has_valid_outer_pip and self._has_virtualenv
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.13/functools.py", line 1037, in __get__
val = self.func(instance)
File "/usr/lib/python3.13/site-packages/build/env.py", line 162, in _has_valid_outer_pip
return _has_dependency('pip', '22.3')
File "/usr/lib/python3.13/site-packages/build/env.py", line 46, in _has_dependency
from packaging.version import Version
ModuleNotFoundError: No module named 'packaging.version'
/builddir/build/BUILD/python-jaraco-packaging-10.2.2-build/jaraco_packaging-10.2.2/jaraco/packaging/metadata.py:22: UnexpectedException
Basically it interpreted jaraco.packaging as packaging
I hope that a src-layout can mitigate the need for --import-mode importlib, but also it might need relative imports all around as well?
Metadata
Metadata
Assignees
Labels
No labels