forked from pypa/virtualenv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_acquire_find_wheel.py
34 lines (23 loc) · 1.24 KB
/
test_acquire_find_wheel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import pytest
from virtualenv.seed.wheels.acquire import find_compatible_in_house
from virtualenv.seed.wheels.embed import BUNDLE_FOLDER, MAX, get_embed_wheel
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)
assert result.path == expected.path
def test_find_less_than():
latest = get_embed_wheel("setuptools", MAX)
result = find_compatible_in_house("setuptools", f"<{latest.version}", MAX, BUNDLE_FOLDER)
assert result is not None
assert result.path != latest.path
def test_find_bad_spec():
with pytest.raises(ValueError, match="bad"):
find_compatible_in_house("setuptools", "bad", MAX, BUNDLE_FOLDER)