Skip to content

Commit

Permalink
Merge pull request #8276 from pfmoore/test_marker
Browse files Browse the repository at this point in the history
Add a mark for tests that fail on the new resolver
  • Loading branch information
pfmoore authored May 21, 2020
2 parents 278ac2d + 66f323a commit a14f9aa
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 2 deletions.
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ignore_errors = True
[tool:pytest]
addopts = --ignore src/pip/_vendor --ignore tests/tests_cache -r aR
markers =
network: tests that needs network
network: tests that need network
incompatible_with_test_venv
incompatible_with_venv
no_auto_tempdir_manager
Expand All @@ -50,6 +50,7 @@ markers =
mercurial: VCS: Mercurial
git: VCS: git
yaml: yaml based tests
fails_on_new_resolver: Does not yet work on the new resolver

[bdist_wheel]
universal = 1
Expand Down
12 changes: 12 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ def pytest_addoption(parser):
default=False,
help="use new resolver in tests",
)
parser.addoption(
"--new-resolver-runtests",
action="store_true",
default=False,
help="run the skipped tests for the new resolver",
)
parser.addoption(
"--use-venv",
action="store_true",
Expand All @@ -59,6 +65,12 @@ def pytest_collection_modifyitems(config, items):
"CI" in os.environ):
item.add_marker(pytest.mark.flaky(reruns=3))

if (item.get_closest_marker('fails_on_new_resolver') and
config.getoption("--new-resolver") and
not config.getoption("--new-resolver-runtests")):
item.add_marker(pytest.mark.skip(
'This test does not work with the new resolver'))

if six.PY3:
if (item.get_closest_marker('incompatible_with_test_venv') and
config.getoption("--use-venv")):
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def test_cache_list_name_and_version_match(script):
assert not list_matches_wheel('zzz-7.8.9', result)


@pytest.mark.usefixture("populate_wheel_cache")
@pytest.mark.usefixtures("populate_wheel_cache")
def test_cache_remove_no_arguments(script):
"""Running `pip cache remove` with no arguments should cause an error."""
script.pip('cache', 'remove', expect_error=True)
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ def test_download_exit_status_code_when_blank_requirements_file(script):
script.pip('download', '-r', 'blank.txt')


@pytest.mark.fails_on_new_resolver
def test_download_prefer_binary_when_tarball_higher_than_wheel(script, data):
fake_wheel(data, 'source-0.8-py2.py3-none-any.whl')
result = script.pip(
Expand Down
8 changes: 8 additions & 0 deletions tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def test_pep518_with_user_pip(script, pip_src, data, common_wheels):
)


@pytest.mark.fails_on_new_resolver
def test_pep518_with_extra_and_markers(script, data, common_wheels):
script.pip(
'wheel', '--no-index',
Expand Down Expand Up @@ -532,6 +533,7 @@ def assert_re_match(pattern, text):


@pytest.mark.network
@pytest.mark.fails_on_new_resolver
def test_hashed_install_failure_later_flag(script, tmpdir):
with requirements_file(
"blessings==1.0\n"
Expand Down Expand Up @@ -937,6 +939,7 @@ def test_install_nonlocal_compatible_wheel(script, data):
assert result.returncode == ERROR


@pytest.mark.fails_on_new_resolver
def test_install_nonlocal_compatible_wheel_path(script, data):
target_dir = script.scratch_path / 'target'

Expand Down Expand Up @@ -1491,6 +1494,7 @@ def test_double_install(script):
assert msg not in result.stderr


@pytest.mark.fails_on_new_resolver
def test_double_install_fail(script):
"""
Test double install failing with two different version requirements
Expand Down Expand Up @@ -1746,6 +1750,7 @@ def test_user_config_accepted(script):
]
)
@pytest.mark.parametrize("use_module", [True, False])
@pytest.mark.fails_on_new_resolver
def test_install_pip_does_not_modify_pip_when_satisfied(
script, install_args, expected_message, use_module):
"""
Expand All @@ -1757,6 +1762,7 @@ def test_install_pip_does_not_modify_pip_when_satisfied(
assert expected_message in result.stdout, str(result)


@pytest.mark.fails_on_new_resolver
def test_ignore_yanked_file(script, data):
"""
Test ignore a "yanked" file.
Expand Down Expand Up @@ -1794,6 +1800,7 @@ def test_valid_index_url_argument(script, shared_data):
assert 'Successfully installed Dinner' in result.stdout, str(result)


@pytest.mark.fails_on_new_resolver
def test_install_yanked_file_and_print_warning(script, data):
"""
Test install a "yanked" file and print a warning.
Expand Down Expand Up @@ -1873,6 +1880,7 @@ def test_install_skip_work_dir_pkg(script, data):
assert 'Successfully installed simple' in result.stdout


@pytest.mark.fails_on_new_resolver
def test_install_include_work_dir_pkg(script, data):
"""
Test that install of a package in working directory
Expand Down
3 changes: 3 additions & 0 deletions tests/functional/test_install_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from tests.lib.server import file_response, package_page


@pytest.mark.fails_on_new_resolver
def test_options_from_env_vars(script):
"""
Test if ConfigOptionParser reads env vars (e.g. not using PyPI here)
Expand Down Expand Up @@ -43,6 +44,7 @@ def test_command_line_options_override_env_vars(script, virtualenv):


@pytest.mark.network
@pytest.mark.fails_on_new_resolver
def test_env_vars_override_config_file(script, virtualenv):
"""
Test that environmental variables override settings in config files.
Expand Down Expand Up @@ -174,6 +176,7 @@ def test_config_file_override_stack(
assert requests[3]["PATH_INFO"] == "/files/INITools-0.2.tar.gz"


@pytest.mark.fails_on_new_resolver
def test_options_from_venv_config(script, virtualenv):
"""
Test if ConfigOptionParser reads a virtualenv-local config file
Expand Down
3 changes: 3 additions & 0 deletions tests/functional/test_install_direct_url.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import re

import pytest

from pip._internal.models.direct_url import DIRECT_URL_METADATA_NAME, DirectUrl
from tests.lib import _create_test_package, path_to_url

Expand Down Expand Up @@ -30,6 +32,7 @@ def test_install_vcs_editable_no_direct_url(script, with_wheel):
assert not _get_created_direct_url(result, "testpkg")


@pytest.mark.fails_on_new_resolver
def test_install_vcs_non_editable_direct_url(script, with_wheel):
pkg_path = _create_test_package(script, name="testpkg")
url = path_to_url(pkg_path)
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_install_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ def test_install_special_extra(script):
pytest.param('[extra2]', '1.0', marks=pytest.mark.xfail),
pytest.param('[extra1,extra2]', '1.0', marks=pytest.mark.xfail),
])
@pytest.mark.fails_on_new_resolver
def test_install_extra_merging(script, data, extra_to_install, simple_version):
# Check that extra specifications in the extras section are honoured.
pkga_path = script.scratch_path / 'pkga'
Expand Down
12 changes: 12 additions & 0 deletions tests/functional/test_install_reqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def test_respect_order_in_requirements_file(script, data):
)


@pytest.mark.fails_on_new_resolver
def test_install_local_editable_with_extras(script, data):
to_install = data.packages.joinpath("LocalExtras")
res = script.pip_install_local(
Expand Down Expand Up @@ -336,6 +337,7 @@ def test_constraints_local_install_causes_error(script, data):
assert 'Could not satisfy constraints for' in result.stderr


@pytest.mark.fails_on_new_resolver
def test_constraints_constrain_to_local_editable(script, data):
to_install = data.src.joinpath("singlemodule")
script.scratch_path.joinpath("constraints.txt").write_text(
Expand All @@ -347,6 +349,7 @@ def test_constraints_constrain_to_local_editable(script, data):
assert 'Running setup.py develop for singlemodule' in result.stdout


@pytest.mark.fails_on_new_resolver
def test_constraints_constrain_to_local(script, data):
to_install = data.src.joinpath("singlemodule")
script.scratch_path.joinpath("constraints.txt").write_text(
Expand All @@ -358,6 +361,7 @@ def test_constraints_constrain_to_local(script, data):
assert 'Running setup.py install for singlemodule' in result.stdout


@pytest.mark.fails_on_new_resolver
def test_constrained_to_url_install_same_url(script, data):
to_install = data.src.joinpath("singlemodule")
constraints = path_to_url(to_install) + "#egg=singlemodule"
Expand Down Expand Up @@ -403,6 +407,7 @@ def test_double_install_spurious_hash_mismatch(
assert 'Successfully installed simple-1.0' in str(result)


@pytest.mark.fails_on_new_resolver
def test_install_with_extras_from_constraints(script, data):
to_install = data.packages.joinpath("LocalExtras")
script.scratch_path.joinpath("constraints.txt").write_text(
Expand All @@ -413,6 +418,7 @@ def test_install_with_extras_from_constraints(script, data):
assert script.site_packages / 'simple' in result.files_created


@pytest.mark.fails_on_new_resolver
def test_install_with_extras_from_install(script, data):
to_install = data.packages.joinpath("LocalExtras")
script.scratch_path.joinpath("constraints.txt").write_text(
Expand All @@ -423,6 +429,7 @@ def test_install_with_extras_from_install(script, data):
assert script.site_packages / 'singlemodule.py' in result.files_created


@pytest.mark.fails_on_new_resolver
def test_install_with_extras_joined(script, data):
to_install = data.packages.joinpath("LocalExtras")
script.scratch_path.joinpath("constraints.txt").write_text(
Expand All @@ -435,6 +442,7 @@ def test_install_with_extras_joined(script, data):
assert script.site_packages / 'singlemodule.py' in result.files_created


@pytest.mark.fails_on_new_resolver
def test_install_with_extras_editable_joined(script, data):
to_install = data.packages.joinpath("LocalExtras")
script.scratch_path.joinpath("constraints.txt").write_text(
Expand Down Expand Up @@ -465,6 +473,7 @@ def test_install_distribution_duplicate_extras(script, data):
assert expected in result.stderr


@pytest.mark.fails_on_new_resolver
def test_install_distribution_union_with_constraints(script, data):
to_install = data.packages.joinpath("LocalExtras")
script.scratch_path.joinpath("constraints.txt").write_text(
Expand All @@ -475,6 +484,7 @@ def test_install_distribution_union_with_constraints(script, data):
assert script.site_packages / 'singlemodule.py' in result.files_created


@pytest.mark.fails_on_new_resolver
def test_install_distribution_union_with_versions(script, data):
to_install_001 = data.packages.joinpath("LocalExtras")
to_install_002 = data.packages.joinpath("LocalExtras-0.0.2")
Expand All @@ -497,6 +507,7 @@ def test_install_distribution_union_conflicting_extras(script, data):
assert "Conflict" in result.stderr


@pytest.mark.fails_on_new_resolver
def test_install_unsupported_wheel_link_with_marker(script):
script.scratch_path.joinpath("with-marker.txt").write_text(
textwrap.dedent("""\
Expand All @@ -515,6 +526,7 @@ def test_install_unsupported_wheel_link_with_marker(script):
assert len(result.files_created) == 0


@pytest.mark.fails_on_new_resolver
def test_install_unsupported_wheel_file(script, data):
# Trying to install a local wheel with an incompatible version/type
# should fail.
Expand Down
3 changes: 3 additions & 0 deletions tests/functional/test_install_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def test_invalid_upgrade_strategy_causes_error(script):
assert "invalid choice" in result.stderr


@pytest.mark.fails_on_new_resolver
def test_only_if_needed_does_not_upgrade_deps_when_satisfied(script):
"""
It doesn't upgrade a dependency if it already satisfies the requirements.
Expand Down Expand Up @@ -181,6 +182,7 @@ def test_upgrade_if_requested(script):
)


@pytest.mark.fails_on_new_resolver
def test_upgrade_with_newest_already_installed(script, data):
"""
If the newest version of a package is already installed, the package should
Expand Down Expand Up @@ -249,6 +251,7 @@ def test_uninstall_before_upgrade_from_url(script):


@pytest.mark.network
@pytest.mark.fails_on_new_resolver
def test_upgrade_to_same_version_from_url(script):
"""
When installing from a URL the same version that is already installed, no
Expand Down
3 changes: 3 additions & 0 deletions tests/functional/test_install_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def test_install_user_conflict_in_usersite(self, script):

@pytest.mark.network
@pytest.mark.incompatible_with_test_venv
@pytest.mark.fails_on_new_resolver
def test_install_user_conflict_in_globalsite(self, virtualenv, script):
"""
Test user install with conflict in global site ignores site and
Expand Down Expand Up @@ -158,6 +159,7 @@ def test_install_user_conflict_in_globalsite(self, virtualenv, script):

@pytest.mark.network
@pytest.mark.incompatible_with_test_venv
@pytest.mark.fails_on_new_resolver
def test_upgrade_user_conflict_in_globalsite(self, virtualenv, script):
"""
Test user install/upgrade with conflict in global site ignores site and
Expand Down Expand Up @@ -189,6 +191,7 @@ def test_upgrade_user_conflict_in_globalsite(self, virtualenv, script):

@pytest.mark.network
@pytest.mark.incompatible_with_test_venv
@pytest.mark.fails_on_new_resolver
def test_install_user_conflict_in_globalsite_and_usersite(
self, virtualenv, script):
"""
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_install_vcs_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ def test_install_git_branch_not_cached(script, with_wheel):
), result.stdout


@pytest.mark.fails_on_new_resolver
def test_install_git_sha_cached(script, with_wheel):
"""
Installing git urls with a sha revision does cause wheel caching.
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_uninstall_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_uninstall_from_usersite(self, script):
result2 = script.pip('uninstall', '-y', 'INITools')
assert_all_changes(result1, result2, [script.venv / 'build', 'cache'])

@pytest.mark.fails_on_new_resolver
def test_uninstall_from_usersite_with_dist_in_global_site(
self, virtualenv, script):
"""
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def test_pip_wheel_success(script, data):
assert "Successfully built simple" in result.stdout, result.stdout


@pytest.mark.fails_on_new_resolver
def test_pip_wheel_build_cache(script, data):
"""
Test 'pip wheel' builds and caches.
Expand Down

0 comments on commit a14f9aa

Please sign in to comment.