mirror of https://github.com/pypa/pip
Add pytest option to globally switch resolver
This commit is contained in:
parent
d911a9fcb8
commit
a82a5e7abe
|
@ -57,10 +57,10 @@ jobs:
|
||||||
- stage: experimental
|
- stage: experimental
|
||||||
env:
|
env:
|
||||||
- GROUP=1
|
- GROUP=1
|
||||||
- PIP_UNSTABLE_FEATURE=resolver
|
- NEW_RESOLVER=1
|
||||||
- env:
|
- env:
|
||||||
- GROUP=2
|
- GROUP=2
|
||||||
- PIP_UNSTABLE_FEATURE=resolver
|
- NEW_RESOLVER=1
|
||||||
|
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
allow_failures:
|
allow_failures:
|
||||||
|
|
|
@ -30,11 +30,23 @@ if MYPY_CHECK_RUNNING:
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
parser.addoption(
|
parser.addoption(
|
||||||
"--keep-tmpdir", action="store_true",
|
"--keep-tmpdir",
|
||||||
default=False, help="keep temporary test directories"
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="keep temporary test directories",
|
||||||
|
)
|
||||||
|
parser.addoption(
|
||||||
|
"--new-resolver",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="use new resolver in tests",
|
||||||
|
)
|
||||||
|
parser.addoption(
|
||||||
|
"--use-venv",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
help="use venv for virtual environment creation",
|
||||||
)
|
)
|
||||||
parser.addoption("--use-venv", action="store_true",
|
|
||||||
help="use venv for virtual environment creation")
|
|
||||||
|
|
||||||
|
|
||||||
def pytest_collection_modifyitems(config, items):
|
def pytest_collection_modifyitems(config, items):
|
||||||
|
@ -75,6 +87,18 @@ def pytest_collection_modifyitems(config, items):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="session", autouse=True)
|
||||||
|
def use_new_resolver(request):
|
||||||
|
"""Set environment variable to make pip default to the new resolver.
|
||||||
|
"""
|
||||||
|
new_resolver = request.config.getoption("--new-resolver")
|
||||||
|
if new_resolver:
|
||||||
|
os.environ["PIP_UNSTABLE_FEATURE"] = "resolver"
|
||||||
|
else:
|
||||||
|
os.environ.pop("PIP_UNSTABLE_FEATURE", None)
|
||||||
|
yield new_resolver
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='session')
|
@pytest.fixture(scope='session')
|
||||||
def tmpdir_factory(request, tmpdir_factory):
|
def tmpdir_factory(request, tmpdir_factory):
|
||||||
""" Modified `tmpdir_factory` session fixture
|
""" Modified `tmpdir_factory` session fixture
|
||||||
|
|
|
@ -37,16 +37,24 @@ if [[ -z "$TOXENV" ]]; then
|
||||||
fi
|
fi
|
||||||
echo "TOXENV=${TOXENV}"
|
echo "TOXENV=${TOXENV}"
|
||||||
|
|
||||||
|
if [[ -z "$NEW_RESOLVER" ]]; then
|
||||||
|
RESOLVER_SWITCH=''
|
||||||
|
else
|
||||||
|
RESOLVER_SWITCH='--new-resolver'
|
||||||
|
fi
|
||||||
|
|
||||||
# Print the commands run for this test.
|
# Print the commands run for this test.
|
||||||
set -x
|
set -x
|
||||||
if [[ "$GROUP" == "1" ]]; then
|
if [[ "$GROUP" == "1" ]]; then
|
||||||
# Unit tests
|
# Unit tests
|
||||||
tox -- --use-venv -m unit -n auto
|
tox -- --use-venv -m unit -n auto
|
||||||
# Integration tests (not the ones for 'pip install')
|
# Integration tests (not the ones for 'pip install')
|
||||||
tox -- --use-venv -m integration -n auto --duration=5 -k "not test_install"
|
tox -- -m integration -n auto --duration=5 -k "not test_install" \
|
||||||
|
--use-venv $RESOLVER_SWITCH
|
||||||
elif [[ "$GROUP" == "2" ]]; then
|
elif [[ "$GROUP" == "2" ]]; then
|
||||||
# Separate Job for running integration tests for 'pip install'
|
# Separate Job for running integration tests for 'pip install'
|
||||||
tox -- --use-venv -m integration -n auto --duration=5 -k "test_install"
|
tox -- -m integration -n auto --duration=5 -k "test_install" \
|
||||||
|
--use-venv $RESOLVER_SWITCH
|
||||||
else
|
else
|
||||||
# Non-Testing Jobs should run once
|
# Non-Testing Jobs should run once
|
||||||
tox
|
tox
|
||||||
|
|
1
tox.ini
1
tox.ini
|
@ -18,7 +18,6 @@ passenv =
|
||||||
HTTP_PROXY
|
HTTP_PROXY
|
||||||
HTTPS_PROXY
|
HTTPS_PROXY
|
||||||
NO_PROXY
|
NO_PROXY
|
||||||
PIP_UNSTABLE_FEATURE
|
|
||||||
setenv =
|
setenv =
|
||||||
# This is required in order to get UTF-8 output inside of the subprocesses
|
# This is required in order to get UTF-8 output inside of the subprocesses
|
||||||
# that our tests use.
|
# that our tests use.
|
||||||
|
|
Loading…
Reference in New Issue