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

Force strict xfail on pytest, and update/remove tests accordingly #10526

Merged
merged 5 commits into from
Sep 30, 2021
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 setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ allow_untyped_defs = True

[tool:pytest]
addopts = --ignore src/pip/_vendor --ignore tests/tests_cache -r aR --color=yes
xfail_strict = True
markers =
network: tests that need network
incompatible_with_sysconfig
Expand Down
24 changes: 17 additions & 7 deletions tests/functional/test_install_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,22 @@ def test_install_requirements_no_r_flag(script):


@pytest.mark.parametrize(
"extra_to_install, simple_version",
"extra_to_install, simple_version, fails_on_legacy",
[
["", "3.0"],
pytest.param("[extra1]", "2.0", marks=pytest.mark.xfail),
pytest.param("[extra2]", "1.0", marks=pytest.mark.xfail),
pytest.param("[extra1,extra2]", "1.0", marks=pytest.mark.xfail),
("", "3.0", False),
("[extra1]", "2.0", True),
("[extra2]", "1.0", True),
("[extra1,extra2]", "1.0", True),
],
)
def test_install_extra_merging(script, data, extra_to_install, simple_version):
@pytest.mark.usefixtures("data")
def test_install_extra_merging(
script,
resolver_variant,
extra_to_install,
simple_version,
fails_on_legacy,
):
# Check that extra specifications in the extras section are honoured.
pkga_path = script.scratch_path / "pkga"
pkga_path.mkdir()
Expand All @@ -200,6 +207,9 @@ def test_install_extra_merging(script, data, extra_to_install, simple_version):

result = script.pip_install_local(
f"{pkga_path}{extra_to_install}",
expect_error=(fails_on_legacy and resolver_variant == "legacy"),
)

assert f"Successfully installed pkga-0.1 simple-{simple_version}" in result.stdout
if not fails_on_legacy or resolver_variant == "2020-resolver":
expected = f"Successfully installed pkga-0.1 simple-{simple_version}"
assert expected in result.stdout
2 changes: 1 addition & 1 deletion tests/functional/test_install_reqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_multiple_constraints_files(script, data):
assert "installed Upper-1.0" in result.stdout


@pytest.mark.xfail(reason="Unclear what this guarantee is for.")
# FIXME: Unclear what this guarantee is for.
def test_respect_order_in_requirements_file(script, data):
script.scratch_path.joinpath("frameworks-req.txt").write_text(
textwrap.dedent(
Expand Down
1 change: 0 additions & 1 deletion tests/functional/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ def test_pip_wheel_fail(script, data):
assert result.returncode != 0


@pytest.mark.xfail(reason="The --build option was removed")
def test_no_clean_option_blocks_cleaning_after_wheel(
script,
data,
Expand Down
8 changes: 0 additions & 8 deletions tests/unit/test_models_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@ def test_not_supported_osx_version(self) -> None:
w = Wheel("simple-0.1-cp27-none-macosx_10_9_intel.whl")
assert not w.supported(tags=tags)

@pytest.mark.xfail(
reason=(
"packaging.tags changed behaviour in this area, and @pradyunsg "
"decided as the release manager that this behaviour change is less "
"critical than Big Sur support for pip 20.3. See "
"https://github.com/pypa/packaging/pull/361 for further discussion."
)
)
def test_supported_multiarch_darwin(self) -> None:
"""
Multi-arch wheels (intel) are supported on components (i386, x86_64)
Expand Down