Skip to content

Commit

Permalink
Test legacy clean not attempt after PEP 517 build failure
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul committed Jan 1, 2020
1 parent ea7bbff commit acd499c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/data/packages/pep517_wrapper_buildsys/mybuildsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@


def build_wheel(*a, **kw):
if os.environ.get("PIP_TEST_FAIL_BUILD_WHEEL"):
raise RuntimeError("Failing build_wheel, as requested.")

# Create the marker file to record that the hook was called
with open(os.environ['PIP_TEST_MARKER_FILE'], 'wb'):
pass
Expand Down
16 changes: 16 additions & 0 deletions tests/functional/test_install_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,19 @@ def test_cleanup_prevented_upon_build_dir_exception(script, data):
assert result.returncode == PREVIOUS_BUILD_DIR_ERROR, str(result)
assert "pip can't proceed" in result.stderr, str(result)
assert exists(build_simple), str(result)


@pytest.mark.network
def test_pep517_no_legacy_cleanup(script, data, with_wheel):
"""Test a PEP 517 failed build does not attempt a legacy cleanup"""
to_install = data.packages.joinpath('pep517_wrapper_buildsys')
script.environ["PIP_TEST_FAIL_BUILD_WHEEL"] = "1"
res = script.pip(
'install', '-f', data.find_links, to_install,
expect_error=True
)
# Must not have built the package
expected = "Failed building wheel for pep517-wrapper-buildsys"
assert expected in str(res)
# Must not have attempted legacy cleanup
assert "setup.py clean" not in str(res)

0 comments on commit acd499c

Please sign in to comment.