Skip to content

Commit af352e2

Browse files
committed
Adapt test to the removal of setup.py install code path
1 parent 10a87ad commit af352e2

File tree

2 files changed

+17
-50
lines changed

2 files changed

+17
-50
lines changed

tests/functional/test_install.py

+16-49
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,10 @@ def test_install_global_option(script: PipTestEnvironment) -> None:
829829
(In particular those that disable the actual install action)
830830
"""
831831
result = script.pip(
832-
"install", "--global-option=--version", "INITools==0.1", expect_stderr=True
832+
"install",
833+
"--global-option=--version",
834+
"INITools==0.1",
835+
expect_error=True, # build is going to fail because of --version
833836
)
834837
assert "INITools==0.1\n" in result.stdout
835838
assert not result.files_created
@@ -1498,15 +1501,12 @@ def test_install_subprocess_output_handling(
14981501
# This error is emitted 3 times:
14991502
# - by setup.py bdist_wheel
15001503
# - by setup.py clean
1501-
# - by setup.py install which is used as fallback when setup.py bdist_wheel failed
1502-
# Before, it failed only once because it attempted only setup.py install.
1503-
# TODO update this when we remove the last setup.py install code path.
1504-
assert 3 == result.stderr.count("I DIE, I DIE")
1504+
assert 2 == result.stderr.count("I DIE, I DIE")
15051505

15061506
result = script.pip(
15071507
*(args + ["--global-option=--fail", "--verbose"]), expect_error=True
15081508
)
1509-
assert 3 == result.stderr.count("I DIE, I DIE")
1509+
assert 2 == result.stderr.count("I DIE, I DIE")
15101510

15111511

15121512
def test_install_log(script: PipTestEnvironment, data: TestData, tmpdir: Path) -> None:
@@ -1526,22 +1526,9 @@ def test_install_topological_sort(script: PipTestEnvironment, data: TestData) ->
15261526
assert order1 in res or order2 in res, res
15271527

15281528

1529-
def test_install_wheel_broken(script: PipTestEnvironment) -> None:
1530-
res = script.pip_install_local("wheelbroken", allow_stderr_error=True)
1531-
assert "ERROR: Failed building wheel for wheelbroken" in res.stderr
1532-
# Fallback to setup.py install (https://github.com/pypa/pip/issues/8368)
1533-
assert "Successfully installed wheelbroken-0.1" in str(res), str(res)
1534-
1535-
15361529
def test_cleanup_after_failed_wheel(script: PipTestEnvironment) -> None:
1537-
res = script.pip_install_local("wheelbrokenafter", allow_stderr_error=True)
1530+
res = script.pip_install_local("wheelbrokenafter", expect_error=True)
15381531
assert "ERROR: Failed building wheel for wheelbrokenafter" in res.stderr
1539-
# One of the effects of not cleaning up is broken scripts:
1540-
script_py = script.bin_path / "script.py"
1541-
assert script_py.exists(), script_py
1542-
with open(script_py) as f:
1543-
shebang = f.readline().strip()
1544-
assert shebang != "#!python", shebang
15451532
# OK, assert that we *said* we were cleaning up:
15461533
# /!\ if in need to change this, also change test_pep517_no_legacy_cleanup
15471534
assert "Running setup.py clean for wheelbrokenafter" in str(res), str(res)
@@ -1568,38 +1555,26 @@ def test_install_builds_wheels(script: PipTestEnvironment, data: TestData) -> No
15681555
"-f",
15691556
data.find_links,
15701557
to_install,
1571-
allow_stderr_error=True, # error building wheelbroken
1572-
)
1573-
expected = (
1574-
"Successfully installed requires-wheelbroken-upper-0"
1575-
" upper-2.0 wheelbroken-0.1"
1558+
expect_error=True, # error building wheelbroken
15761559
)
1577-
# Must have installed it all
1578-
assert expected in str(res), str(res)
15791560
wheels: List[str] = []
15801561
for _, _, files in os.walk(wheels_cache):
15811562
wheels.extend(f for f in files if f.endswith(".whl"))
1582-
# and built wheels for upper and wheelbroken
1563+
# Built wheel for upper
15831564
assert "Building wheel for upper" in str(res), str(res)
1565+
# Built wheel for wheelbroken, but failed
15841566
assert "Building wheel for wheelb" in str(res), str(res)
1567+
assert "Failed to build wheelbroken" in str(res), str(res)
15851568
# Wheels are built for local directories, but not cached.
15861569
assert "Building wheel for requir" in str(res), str(res)
1587-
# wheelbroken has to run install
15881570
# into the cache
15891571
assert wheels != [], str(res)
1590-
# and installed from the wheel
1591-
assert "Running setup.py install for upper" not in str(res), str(res)
1592-
# Wheels are built for local directories, but not cached.
1593-
assert "Running setup.py install for requir" not in str(res), str(res)
1594-
# wheelbroken has to run install
1595-
assert "Running setup.py install for wheelb" in str(res), str(res)
1596-
# We want to make sure pure python wheels do not have an implementation tag
15971572
assert wheels == [
15981573
"Upper-2.0-py{}-none-any.whl".format(sys.version_info[0]),
15991574
]
16001575

16011576

1602-
def test_install_no_binary_disables_building_wheels(
1577+
def test_install_no_binary_builds_wheels(
16031578
script: PipTestEnvironment, data: TestData
16041579
) -> None:
16051580
to_install = data.packages.joinpath("requires_wheelbroken_upper")
@@ -1610,22 +1585,14 @@ def test_install_no_binary_disables_building_wheels(
16101585
"-f",
16111586
data.find_links,
16121587
to_install,
1613-
allow_stderr_error=True, # error building wheelbroken
1588+
expect_error=True, # error building wheelbroken
16141589
)
1615-
expected = (
1616-
"Successfully installed requires-wheelbroken-upper-0"
1617-
" upper-2.0 wheelbroken-0.1"
1618-
)
1619-
# Must have installed it all
1620-
assert expected in str(res), str(res)
1621-
# and built wheels for wheelbroken only
1590+
# Wheels are built for all requirements
16221591
assert "Building wheel for wheelb" in str(res), str(res)
1623-
# Wheels are built for local directories, but not cached across runs
16241592
assert "Building wheel for requir" in str(res), str(res)
1625-
# Don't build wheel for upper which was blacklisted
16261593
assert "Building wheel for upper" in str(res), str(res)
1627-
# And these two fell back to sdist based installed.
1628-
assert "Running setup.py install for wheelb" in str(res), str(res)
1594+
# Wheelbroken failed to build
1595+
assert "Failed to build wheelbroken" in str(res), str(res)
16291596

16301597

16311598
@pytest.mark.network

tests/functional/test_install_vcs_git.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ def test_git_with_non_editable_unpacking(
392392
)
393393
result = script.pip(
394394
"install",
395-
"--global-option=--version",
395+
"--global-option=--quiet",
396396
local_url,
397397
allow_stderr_warning=True,
398398
)

0 commit comments

Comments
 (0)