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

Allow empty string as version for find_compatible_in_house #2430

Merged
merged 1 commit into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog/2429.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix fallback handling of downloading wheels for bundled packages - by :user:`schaap`.
2 changes: 1 addition & 1 deletion src/virtualenv/seed/wheels/acquire.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def _find_downloaded_wheel(distribution, version_spec, for_py_version, to_folder
def find_compatible_in_house(distribution, version_spec, for_py_version, in_folder):
wheels = discover_wheels(in_folder, distribution, None, for_py_version)
start, end = 0, len(wheels)
if version_spec is not None:
if version_spec is not None and version_spec != "":
if version_spec.startswith("<"):
from_pos, op = 1, lt
elif version_spec.startswith("=="):
Expand Down
8 changes: 7 additions & 1 deletion tests/unit/seed/wheels/test_acquire_find_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
from virtualenv.seed.wheels.embed import BUNDLE_FOLDER, MAX, get_embed_wheel


def test_find_latest(for_py_version):
def test_find_latest_none(for_py_version):
result = find_compatible_in_house("setuptools", None, for_py_version, BUNDLE_FOLDER)
expected = get_embed_wheel("setuptools", for_py_version)
assert result.path == expected.path


def test_find_latest_string(for_py_version):
result = find_compatible_in_house("setuptools", "", for_py_version, BUNDLE_FOLDER)
expected = get_embed_wheel("setuptools", for_py_version)
assert result.path == expected.path


def test_find_exact(for_py_version):
expected = get_embed_wheel("setuptools", for_py_version)
result = find_compatible_in_house("setuptools", f"=={expected.version}", for_py_version, BUNDLE_FOLDER)
Expand Down