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_use_invalid_wrapper_python test fails #1516

Closed
1 task done
mcepl opened this issue Nov 15, 2022 · 0 comments · Fixed by #1518
Closed
1 task done

test_use_invalid_wrapper_python test fails #1516

mcepl opened this issue Nov 15, 2022 · 0 comments · Fixed by #1518
Labels
🐛 bug Something isn't working

Comments

@mcepl
Copy link

mcepl commented Nov 15, 2022

While packaging pdm 2.2.1 for openSUSE/Factory we have discovered failing test test_use_invalid_wrapper_python:

  • I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

Run the test suite:

[  198s] =================================== FAILURES ===================================
[  198s] _______________________ test_use_invalid_wrapper_python ________________________
[  198s] 
[  198s] project = <Project '/tmp/pytest-of-abuild/pytest-0/test_use_invalid_wrapper_pytho0'>
[  198s] 
[  198s]     @pytest.mark.skipif(os.name != "posix", reason="Run on POSIX platforms only")
[  198s]     def test_use_invalid_wrapper_python(project):
[  198s]         wrapper_script = """#!/bin/bash
[  198s]     echo hello
[  198s]     """
[  198s]         shim_path = project.root.joinpath("python_shim.sh")
[  198s]         shim_path.write_text(wrapper_script)
[  198s]         shim_path.chmod(0o755)
[  198s]         with pytest.raises(InvalidPyVersion):
[  198s] >           actions.do_use(project, shim_path.as_posix())
[  198s] 
[  198s] tests/cli/test_use.py:60: 
[  198s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  198s] /usr/lib/python3.8/site-packages/pdm/cli/actions.py:617: in do_use
[  198s]     matching_interpreters = list(filter(version_matcher, found_interpreters))
[  198s] /usr/lib/python3.8/site-packages/pdm/cli/actions.py:588: in version_matcher
[  198s]     str(py_version.version), True
[  198s] /usr/lib/python3.8/site-packages/pdm/models/python.py:48: in version
[  198s]     return self._py_ver.version
[  198s] /usr/lib/python3.8/site-packages/findpython/python.py:65: in version
[  198s]     self._version = self._get_version()
[  198s] /usr/lib/python3.8/site-packages/findpython/python.py:165: in _get_version
[  198s]     return Version(version)
[  198s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[  198s] 
[  198s] self = <[AttributeError("'Version' object has no attribute '_version'") raised in repr()] Version object at 0x7ff1cd2fbd00>
[  198s] version = 'hello'
[  198s] 
[  198s]     def __init__(self, version: str) -> None:
[  198s]     
[  198s]         # Validate the version and parse it into pieces
[  198s]         match = self._regex.search(version)
[  198s]         if not match:
[  198s] >           raise InvalidVersion(f"Invalid version: '{version}'")
[  198s] E           packaging.version.InvalidVersion: Invalid version: 'hello'
[  198s] 
[  198s] /usr/lib/python3.8/site-packages/packaging/version.py:266: InvalidVersion
[  198s] ---------------------------- Captured stdout setup -----------------------------
[  198s] Changes are written to pyproject.toml.
[  198s] =============================== warnings summary ===============================
[  198s] tests/test_integration.py:31
[  198s]   /home/abuild/rpmbuild/BUILD/pdm-2.2.1/tests/test_integration.py:31: PytestUnknownMarkWarning: Unknown pytest.mark.flaky - is this a typo?  You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
[  198s]     @pytest.mark.flaky(reruns=3)
[  198s] 
[  198s] -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
[  198s] =========================== short test summary info ============================
[  198s] FAILED tests/cli/test_use.py::test_use_invalid_wrapper_python - packaging.ver...
[  198s] ===== 1 failed, 585 passed, 12 deselected, 1 warning in 184.12s (0:03:04) ======

Actual behavior

Test fails

Expected behavior

Whole test suite passes.

Environment Information

# Paste the output of `pdm info && pdm info --env` below:

stitny/t/pdm-test$ pdm info
PDM version:
  2.2.1
Python Interpreter:
  /tmp/pdm-test/.venv/bin/python (3.10)
Project Root:
  /tmp/pdm-test
Project Packages:
  None
stitny/t/pdm-test$ pdm info --env
{
  "implementation_name": "cpython",
  "implementation_version": "3.10.8",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "6.0.8-1-default",
  "platform_system": "Linux",
  "platform_version": "#1 SMP PREEMPT_DYNAMIC Fri Nov 11 08:02:50 UTC 2022 (1579d93)",
  "python_full_version": "3.10.8",
  "platform_python_implementation": "CPython",
  "python_version": "3.10",
  "sys_platform": "linux"
}
stitny/t/pdm-test$ 

Complete build log for version of packages used and steps taken.

@mcepl mcepl added the 🐛 bug Something isn't working label Nov 15, 2022
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Nov 16, 2022
https://build.opensuse.org/request/show/1036217
by user mcepl + dimstar_suse
- Add findpython-022.patch to make package work with findpython
  0.2.2 (from gh#pdm-project/pdm#1516).
- Skip failing test (gh#pdm-project/pdm#1516).
- Update to v2.2.1
  Features & Improvements#
  * Make sitecustomize.py respect the PDM_PROJECT_MAX_DEPTH environment variable #1471
  Bug Fixes#
  * Fix the comparison of python_version in the environment marker. When the version contains only one digit, the result was incorrect. #1484
- Update to v2.2.0
  Features & Improvements#
  * Add venv.prompt configuration to allow customizing prompt when a virtualenv is activated #1332
  * Allow the use of custom CA certificates per publish repository using ca_certs or from the command line via pdm publish --ca-certs <path> .... #1392
  * Rename the plugin command to self, and it can not only manag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant