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

Running tests in Fedora packaging #148

Open
LecrisUT opened this issue Sep 18, 2024 · 0 comments
Open

Running tests in Fedora packaging #148

LecrisUT opened this issue Sep 18, 2024 · 0 comments

Comments

@LecrisUT
Copy link

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:

__________________ [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?

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

1 participant