Skip to content

Commit 605d68e

Browse files
authored
Merge pull request #10492 from jdufresne/with-wheel
Use @pytest.mark.usefixture("with_wheel") in tests
2 parents a902f5c + fa0804b commit 605d68e

15 files changed

+148
-92
lines changed

news/52ff07b1-69ed-4bbe-a3be-913e0e247cee.trivial.rst

Whitespace-only changes.

tests/functional/test_download.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,8 @@ def make_wheel_with_python_requires(script, package_name, python_requires):
622622
return package_dir / "dist" / file_name
623623

624624

625-
def test_download__python_version_used_for_python_requires(
626-
script,
627-
data,
628-
with_wheel,
629-
):
625+
@pytest.mark.usefixtures("with_wheel")
626+
def test_download__python_version_used_for_python_requires(script, data):
630627
"""
631628
Test that --python-version is used for the Requires-Python check.
632629
"""
@@ -664,10 +661,8 @@ def make_args(python_version):
664661
script.pip(*args) # no exception
665662

666663

667-
def test_download_ignore_requires_python_dont_fail_with_wrong_python(
668-
script,
669-
with_wheel,
670-
):
664+
@pytest.mark.usefixtures("with_wheel")
665+
def test_download_ignore_requires_python_dont_fail_with_wrong_python(script):
671666
"""
672667
Test that --ignore-requires-python ignores Requires-Python check.
673668
"""

tests/functional/test_freeze.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ def test_exclude_and_normalization(script, tmpdir):
101101
assert "Normalizable_Name" not in result.stdout
102102

103103

104-
def test_freeze_multiple_exclude_with_all(script, with_wheel):
104+
@pytest.mark.usefixtures("with_wheel")
105+
def test_freeze_multiple_exclude_with_all(script):
105106
result = script.pip("freeze", "--all")
106107
assert "pip==" in result.stdout
107108
assert "wheel==" in result.stdout
@@ -938,7 +939,8 @@ def test_freeze_path_multiple(tmpdir, script, data):
938939
_check_output(result.stdout, expected)
939940

940941

941-
def test_freeze_direct_url_archive(script, shared_data, with_wheel):
942+
@pytest.mark.usefixtures("with_wheel")
943+
def test_freeze_direct_url_archive(script, shared_data):
942944
req = "simple @ " + path_to_url(shared_data.packages / "simple-2.0.tar.gz")
943945
assert req.startswith("simple @ file://")
944946
script.pip("install", req)

tests/functional/test_install.py

Lines changed: 60 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,9 @@ def test_pep518_forkbombs(script, data, common_wheels, command, package):
222222

223223

224224
@pytest.mark.network
225+
@pytest.mark.usefixtures("with_wheel")
225226
def test_pip_second_command_line_interface_works(
226-
script, pip_src, data, common_wheels, deprecated_python, with_wheel
227+
script, pip_src, data, common_wheels, deprecated_python
227228
):
228229
"""
229230
Check if ``pip<PYVERSION>`` commands behaves equally
@@ -258,7 +259,8 @@ def test_install_exit_status_code_when_blank_requirements_file(script):
258259

259260

260261
@pytest.mark.network
261-
def test_basic_install_from_pypi(script, with_wheel):
262+
@pytest.mark.usefixtures("with_wheel")
263+
def test_basic_install_from_pypi(script):
262264
"""
263265
Test installing a package from PyPI.
264266
"""
@@ -316,7 +318,8 @@ def test_basic_install_editable_from_git(script):
316318
_test_install_editable_from_git(script)
317319

318320

319-
def test_install_editable_from_git_autobuild_wheel(script, with_wheel):
321+
@pytest.mark.usefixtures("with_wheel")
322+
def test_install_editable_from_git_autobuild_wheel(script):
320323
_test_install_editable_from_git(script)
321324

322325

@@ -434,7 +437,8 @@ def test_vcs_url_urlquote_normalization(script, tmpdir):
434437

435438

436439
@pytest.mark.parametrize("resolver", ["", "--use-deprecated=legacy-resolver"])
437-
def test_basic_install_from_local_directory(script, data, resolver, with_wheel):
440+
@pytest.mark.usefixtures("with_wheel")
441+
def test_basic_install_from_local_directory(script, data, resolver):
438442
"""
439443
Test installing from a local directory.
440444
"""
@@ -461,9 +465,8 @@ def test_basic_install_from_local_directory(script, data, resolver, with_wheel):
461465
("embedded_rel_path", True),
462466
],
463467
)
464-
def test_basic_install_relative_directory(
465-
script, data, test_type, editable, with_wheel
466-
):
468+
@pytest.mark.usefixtures("with_wheel")
469+
def test_basic_install_relative_directory(script, data, test_type, editable):
467470
"""
468471
Test installing a requirement using a relative path.
469472
"""
@@ -578,9 +581,8 @@ def test_hashed_install_failure_later_flag(script, tmpdir):
578581
)
579582

580583

581-
def test_install_from_local_directory_with_symlinks_to_directories(
582-
script, data, with_wheel
583-
):
584+
@pytest.mark.usefixtures("with_wheel")
585+
def test_install_from_local_directory_with_symlinks_to_directories(script, data):
584586
"""
585587
Test installing from a local directory containing symlinks to directories.
586588
"""
@@ -592,7 +594,8 @@ def test_install_from_local_directory_with_symlinks_to_directories(
592594
result.did_create(dist_info_folder)
593595

594596

595-
def test_install_from_local_directory_with_in_tree_build(script, data, with_wheel):
597+
@pytest.mark.usefixtures("with_wheel")
598+
def test_install_from_local_directory_with_in_tree_build(script, data):
596599
"""
597600
Test installing from a local directory with --use-feature=in-tree-build.
598601
"""
@@ -610,9 +613,8 @@ def test_install_from_local_directory_with_in_tree_build(script, data, with_whee
610613

611614

612615
@pytest.mark.skipif("sys.platform == 'win32'")
613-
def test_install_from_local_directory_with_socket_file(
614-
script, data, tmpdir, with_wheel
615-
):
616+
@pytest.mark.usefixtures("with_wheel")
617+
def test_install_from_local_directory_with_socket_file(script, data, tmpdir):
616618
"""
617619
Test installing from a local directory containing a socket file.
618620
"""
@@ -689,7 +691,8 @@ def test_upgrade_argparse_shadowed(script):
689691
assert "Not uninstalling argparse" not in result.stdout
690692

691693

692-
def test_install_curdir(script, data, with_wheel):
694+
@pytest.mark.usefixtures("with_wheel")
695+
def test_install_curdir(script, data):
693696
"""
694697
Test installing current directory ('.').
695698
"""
@@ -705,7 +708,8 @@ def test_install_curdir(script, data, with_wheel):
705708
result.did_create(dist_info_folder)
706709

707710

708-
def test_install_pardir(script, data, with_wheel):
711+
@pytest.mark.usefixtures("with_wheel")
712+
def test_install_pardir(script, data):
709713
"""
710714
Test installing parent directory ('..').
711715
"""
@@ -780,7 +784,8 @@ def test_install_global_option_using_editable(script, tmpdir):
780784

781785

782786
@pytest.mark.network
783-
def test_install_package_with_same_name_in_curdir(script, with_wheel):
787+
@pytest.mark.usefixtures("with_wheel")
788+
def test_install_package_with_same_name_in_curdir(script):
784789
"""
785790
Test installing a package with the same name of a local folder
786791
"""
@@ -798,7 +803,8 @@ def test_install_package_with_same_name_in_curdir(script, with_wheel):
798803
)
799804

800805

801-
def test_install_folder_using_dot_slash(script, with_wheel):
806+
@pytest.mark.usefixtures("with_wheel")
807+
def test_install_folder_using_dot_slash(script):
802808
"""
803809
Test installing a folder using pip install ./foldername
804810
"""
@@ -810,7 +816,8 @@ def test_install_folder_using_dot_slash(script, with_wheel):
810816
result.did_create(dist_info_folder)
811817

812818

813-
def test_install_folder_using_slash_in_the_end(script, with_wheel):
819+
@pytest.mark.usefixtures("with_wheel")
820+
def test_install_folder_using_slash_in_the_end(script):
814821
r"""
815822
Test installing a folder using pip install foldername/ or foldername\
816823
"""
@@ -822,7 +829,8 @@ def test_install_folder_using_slash_in_the_end(script, with_wheel):
822829
result.did_create(dist_info_folder)
823830

824831

825-
def test_install_folder_using_relative_path(script, with_wheel):
832+
@pytest.mark.usefixtures("with_wheel")
833+
def test_install_folder_using_relative_path(script):
826834
"""
827835
Test installing a folder using pip install folder1/folder2
828836
"""
@@ -836,7 +844,8 @@ def test_install_folder_using_relative_path(script, with_wheel):
836844

837845

838846
@pytest.mark.network
839-
def test_install_package_which_contains_dev_in_name(script, with_wheel):
847+
@pytest.mark.usefixtures("with_wheel")
848+
def test_install_package_which_contains_dev_in_name(script):
840849
"""
841850
Test installing package from PyPI which contains 'dev' in name
842851
"""
@@ -847,7 +856,8 @@ def test_install_package_which_contains_dev_in_name(script, with_wheel):
847856
result.did_create(dist_info_folder)
848857

849858

850-
def test_install_package_with_target(script, with_wheel):
859+
@pytest.mark.usefixtures("with_wheel")
860+
def test_install_package_with_target(script):
851861
"""
852862
Test installing a package using pip install --target
853863
"""
@@ -975,7 +985,8 @@ def test_install_nonlocal_compatible_wheel_path(
975985

976986

977987
@pytest.mark.parametrize("opt", ("--target", "--prefix"))
978-
def test_install_with_target_or_prefix_and_scripts_no_warning(opt, script, with_wheel):
988+
@pytest.mark.usefixtures("with_wheel")
989+
def test_install_with_target_or_prefix_and_scripts_no_warning(opt, script):
979990
"""
980991
Test that installing with --target does not trigger the "script not
981992
in PATH" warning (issue #5201)
@@ -1011,7 +1022,8 @@ def main(): pass
10111022
assert "--no-warn-script-location" not in result.stderr, str(result)
10121023

10131024

1014-
def test_install_package_with_root(script, data, with_wheel):
1025+
@pytest.mark.usefixtures("with_wheel")
1026+
def test_install_package_with_root(script, data):
10151027
"""
10161028
Test installing a package using pip install --root
10171029
"""
@@ -1194,7 +1206,8 @@ def test_install_package_with_latin1_setup(script, data):
11941206
script.pip("install", to_install)
11951207

11961208

1197-
def test_url_req_case_mismatch_no_index(script, data, with_wheel):
1209+
@pytest.mark.usefixtures("with_wheel")
1210+
def test_url_req_case_mismatch_no_index(script, data):
11981211
"""
11991212
tar ball url requirements (with no egg fragment), that happen to have upper
12001213
case project names, should be considered equal to later requirements that
@@ -1215,7 +1228,8 @@ def test_url_req_case_mismatch_no_index(script, data, with_wheel):
12151228
result.did_not_create(dist_info_folder)
12161229

12171230

1218-
def test_url_req_case_mismatch_file_index(script, data, with_wheel):
1231+
@pytest.mark.usefixtures("with_wheel")
1232+
def test_url_req_case_mismatch_file_index(script, data):
12191233
"""
12201234
tar ball url requirements (with no egg fragment), that happen to have upper
12211235
case project names, should be considered equal to later requirements that
@@ -1242,7 +1256,8 @@ def test_url_req_case_mismatch_file_index(script, data, with_wheel):
12421256
result.did_not_create(dist_info_folder)
12431257

12441258

1245-
def test_url_incorrect_case_no_index(script, data, with_wheel):
1259+
@pytest.mark.usefixtures("with_wheel")
1260+
def test_url_incorrect_case_no_index(script, data):
12461261
"""
12471262
Same as test_url_req_case_mismatch_no_index, except testing for the case
12481263
where the incorrect case is given in the name of the package to install
@@ -1263,7 +1278,8 @@ def test_url_incorrect_case_no_index(script, data, with_wheel):
12631278
result.did_create(dist_info_folder)
12641279

12651280

1266-
def test_url_incorrect_case_file_index(script, data, with_wheel):
1281+
@pytest.mark.usefixtures("with_wheel")
1282+
def test_url_incorrect_case_file_index(script, data):
12671283
"""
12681284
Same as test_url_req_case_mismatch_file_index, except testing for the case
12691285
where the incorrect case is given in the name of the package to install
@@ -1408,12 +1424,14 @@ def test_install_topological_sort(script, data):
14081424
assert order1 in res or order2 in res, res
14091425

14101426

1411-
def test_install_wheel_broken(script, with_wheel):
1427+
@pytest.mark.usefixtures("with_wheel")
1428+
def test_install_wheel_broken(script):
14121429
res = script.pip_install_local("wheelbroken", expect_stderr=True)
14131430
assert "Successfully installed wheelbroken-0.1" in str(res), str(res)
14141431

14151432

1416-
def test_cleanup_after_failed_wheel(script, with_wheel):
1433+
@pytest.mark.usefixtures("with_wheel")
1434+
def test_cleanup_after_failed_wheel(script):
14171435
res = script.pip_install_local("wheelbrokenafter", expect_stderr=True)
14181436
# One of the effects of not cleaning up is broken scripts:
14191437
script_py = script.bin_path / "script.py"
@@ -1426,7 +1444,8 @@ def test_cleanup_after_failed_wheel(script, with_wheel):
14261444
assert "Running setup.py clean for wheelbrokenafter" in str(res), str(res)
14271445

14281446

1429-
def test_install_builds_wheels(script, data, with_wheel):
1447+
@pytest.mark.usefixtures("with_wheel")
1448+
def test_install_builds_wheels(script, data):
14301449
# We need to use a subprocess to get the right value on Windows.
14311450
res = script.run(
14321451
"python",
@@ -1473,7 +1492,8 @@ def test_install_builds_wheels(script, data, with_wheel):
14731492
]
14741493

14751494

1476-
def test_install_no_binary_disables_building_wheels(script, data, with_wheel):
1495+
@pytest.mark.usefixtures("with_wheel")
1496+
def test_install_no_binary_disables_building_wheels(script, data):
14771497
to_install = data.packages.joinpath("requires_wheelbroken_upper")
14781498
res = script.pip(
14791499
"install",
@@ -1504,7 +1524,8 @@ def test_install_no_binary_disables_building_wheels(script, data, with_wheel):
15041524

15051525

15061526
@pytest.mark.network
1507-
def test_install_no_binary_builds_pep_517_wheel(script, data, with_wheel):
1527+
@pytest.mark.usefixtures("with_wheel")
1528+
def test_install_no_binary_builds_pep_517_wheel(script, data):
15081529
to_install = data.packages.joinpath("pep517_setup_and_pyproject")
15091530
res = script.pip("install", "--no-binary=:all:", "-f", data.find_links, to_install)
15101531
expected = "Successfully installed pep517-setup-and-pyproject"
@@ -1516,7 +1537,8 @@ def test_install_no_binary_builds_pep_517_wheel(script, data, with_wheel):
15161537

15171538

15181539
@pytest.mark.network
1519-
def test_install_no_binary_uses_local_backend(script, data, with_wheel, tmpdir):
1540+
@pytest.mark.usefixtures("with_wheel")
1541+
def test_install_no_binary_uses_local_backend(script, data, tmpdir):
15201542
to_install = data.packages.joinpath("pep517_wrapper_buildsys")
15211543
script.environ["PIP_TEST_MARKER_FILE"] = marker = str(tmpdir / "marker")
15221544
res = script.pip("install", "--no-binary=:all:", "-f", data.find_links, to_install)
@@ -1527,7 +1549,8 @@ def test_install_no_binary_uses_local_backend(script, data, with_wheel, tmpdir):
15271549
assert os.path.isfile(marker), "Local PEP 517 backend not used"
15281550

15291551

1530-
def test_install_no_binary_disables_cached_wheels(script, data, with_wheel):
1552+
@pytest.mark.usefixtures("with_wheel")
1553+
def test_install_no_binary_disables_cached_wheels(script, data):
15311554
# Seed the cache
15321555
script.pip("install", "--no-index", "-f", data.find_links, "upper")
15331556
script.pip("uninstall", "upper", "-y")
@@ -1659,7 +1682,8 @@ def test_install_incompatible_python_requires_editable(script):
16591682
assert _get_expected_error_text() in result.stderr, str(result)
16601683

16611684

1662-
def test_install_incompatible_python_requires_wheel(script, with_wheel):
1685+
@pytest.mark.usefixtures("with_wheel")
1686+
def test_install_incompatible_python_requires_wheel(script):
16631687
script.scratch_path.joinpath("pkga").mkdir()
16641688
pkga_path = script.scratch_path / "pkga"
16651689
pkga_path.joinpath("setup.py").write_text(

tests/functional/test_install_cleanup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def test_no_clean_option_blocks_cleaning_after_install(script, data):
2727

2828

2929
@pytest.mark.network
30-
def test_pep517_no_legacy_cleanup(script, data, with_wheel):
30+
@pytest.mark.usefixtures("with_wheel")
31+
def test_pep517_no_legacy_cleanup(script, data):
3132
"""Test a PEP 517 failed build does not attempt a legacy cleanup"""
3233
to_install = data.packages.joinpath("pep517_wrapper_buildsys")
3334
script.environ["PIP_TEST_FAIL_BUILD_WHEEL"] = "1"

tests/functional/test_install_config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ def test_options_from_venv_config(script, virtualenv):
222222
assert msg.lower() in result.stdout.lower(), str(result)
223223

224224

225-
def test_install_no_binary_via_config_disables_cached_wheels(script, data, with_wheel):
225+
@pytest.mark.usefixtures("with_wheel")
226+
def test_install_no_binary_via_config_disables_cached_wheels(script, data):
226227
config_file = tempfile.NamedTemporaryFile(mode="wt", delete=False)
227228
try:
228229
script.environ["PIP_CONFIG_FILE"] = config_file.name

0 commit comments

Comments
 (0)