Skip to content

Commit b46fb6b

Browse files
committed
Run tests for lazy wheel on Travis
1 parent 55dafe2 commit b46fb6b

File tree

6 files changed

+46
-10
lines changed

6 files changed

+46
-10
lines changed

.travis.yml

+12
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,24 @@ jobs:
3838
env:
3939
- GROUP=1
4040
- NEW_RESOLVER=1
41+
- env:
42+
- GROUP=1
43+
- NEW_RESOLVER=1
44+
- LAZY_WHEEL=1
4145
- env:
4246
- GROUP=2
4347
- NEW_RESOLVER=1
48+
- env:
49+
- GROUP=2
50+
- NEW_RESOLVER=1
51+
- LAZY_WHEEL=1
52+
- env:
53+
- GROUP=3
54+
- NEW_RESOLVER=1
4455
- env:
4556
- GROUP=3
4657
- NEW_RESOLVER=1
58+
- LAZY_WHEEL=1
4759

4860
fast_finish: true
4961
allow_failures:

news/8532.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Allow the new resolver to obtain dependency information through wheels
22
lazily downloaded using HTTP range requests. To enable this feature,
3-
invoke ``pip`` with ``--use-feature=lazy-wheel``.
3+
invoke ``pip`` with ``--use-feature=2020-resolver-lazy-wheel``.

src/pip/_internal/cli/cmdoptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ def check_list_path_option(options):
916916
metavar='feature',
917917
action='append',
918918
default=[],
919-
choices=['2020-resolver', 'lazy-wheel'],
919+
choices=['2020-resolver', '2020-resolver-lazy-wheel'],
920920
help='Enable new functionality, that may be backward incompatible.',
921921
) # type: Callable[..., Option]
922922

src/pip/_internal/cli/req_command.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,18 @@ def make_resolver(
254254
isolated=options.isolated_mode,
255255
use_pep517=use_pep517,
256256
)
257+
258+
if '2020-resolver-lazy-wheel' in options.features_enabled:
259+
use_2020_resolver = use_lazy_wheel = True
260+
elif '2020-resolver' in options.features_enabled:
261+
use_2020_resolver, use_lazy_wheel = True, False
262+
else:
263+
use_2020_resolver = use_lazy_wheel = False
264+
257265
# The long import name and duplicated invocation is needed to convince
258266
# Mypy into correctly typechecking. Otherwise it would complain the
259267
# "Resolver" class being redefined.
260-
if '2020-resolver' in options.features_enabled:
268+
if use_2020_resolver:
261269
import pip._internal.resolution.resolvelib.resolver
262270
return pip._internal.resolution.resolvelib.resolver.Resolver(
263271
preparer=preparer,
@@ -271,7 +279,7 @@ def make_resolver(
271279
force_reinstall=force_reinstall,
272280
upgrade_strategy=upgrade_strategy,
273281
py_version_info=py_version_info,
274-
lazy_wheel='lazy-wheel' in options.features_enabled,
282+
lazy_wheel=use_lazy_wheel,
275283
)
276284
import pip._internal.resolution.legacy.resolver
277285
return pip._internal.resolution.legacy.resolver.Resolver(

tests/conftest.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ def pytest_addoption(parser):
4747
default=False,
4848
help="run the skipped tests for the new resolver",
4949
)
50+
parser.addoption(
51+
"--lazy-wheel",
52+
action="store_true",
53+
default=False,
54+
help="use lazy wheels in tests (only affect new resolver)",
55+
)
5056
parser.addoption(
5157
"--use-venv",
5258
action="store_true",
@@ -102,12 +108,16 @@ def pytest_collection_modifyitems(config, items):
102108
@pytest.fixture(scope="session", autouse=True)
103109
def use_new_resolver(request):
104110
"""Set environment variable to make pip default to the new resolver.
111+
112+
Lazy wheel, an optimization, is also decided here.
105113
"""
106114
new_resolver = request.config.getoption("--new-resolver")
107-
if new_resolver:
108-
os.environ["PIP_USE_FEATURE"] = "2020-resolver"
109-
else:
115+
if not new_resolver:
110116
os.environ.pop("PIP_USE_FEATURE", None)
117+
elif request.config.getoption("--lazy-wheel"):
118+
os.environ["PIP_USE_FEATURE"] = "2020-resolver-lazy-wheel"
119+
else:
120+
os.environ["PIP_USE_FEATURE"] = "2020-resolver"
111121
yield new_resolver
112122

113123

tools/travis/run.sh

+9-3
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,28 @@ else
4343
RESOLVER_SWITCH='--new-resolver'
4444
fi
4545

46+
if [[ -z "$LAZY_WHEEL" ]]; then
47+
LAZY_WHEEL_SWITCH=''
48+
else
49+
LAZY_WHEEL_SWITCH='--lazy-wheel'
50+
fi
51+
4652
# Print the commands run for this test.
4753
set -x
4854
if [[ "$GROUP" == "1" ]]; then
4955
# Unit tests
5056
tox -- --use-venv -m unit -n auto
5157
# Integration tests (not the ones for 'pip install')
5258
tox -- -m integration -n auto --duration=5 -k "not test_install" \
53-
--use-venv $RESOLVER_SWITCH
59+
--use-venv $RESOLVER_SWITCH $LAZY_WHEEL_SWITCH
5460
elif [[ "$GROUP" == "2" ]]; then
5561
# Separate Job for running integration tests for 'pip install'
5662
tox -- -m integration -n auto --duration=5 -k "test_install" \
57-
--use-venv $RESOLVER_SWITCH
63+
--use-venv $RESOLVER_SWITCH $LAZY_WHEEL_SWITCH
5864
elif [[ "$GROUP" == "3" ]]; then
5965
# Separate Job for tests that fail with the new resolver
6066
tox -- -m fails_on_new_resolver -n auto --duration=5 \
61-
--use-venv $RESOLVER_SWITCH --new-resolver-runtests
67+
--use-venv $RESOLVER_SWITCH --new-resolver-runtests $LAZY_WHEEL_SWITCH
6268
else
6369
# Non-Testing Jobs should run once
6470
tox

0 commit comments

Comments
 (0)