Add an integration test of installing a project with a local PEP 517 backend

This commit is contained in:
Thomas Kluyver 2019-11-23 18:45:09 +00:00
parent 400cf8d71e
commit 59550aaec3
5 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,15 @@
import os
from setuptools.build_meta import build_sdist
from setuptools.build_meta import build_wheel as setuptools_build_wheel
from setuptools.build_meta import (get_requires_for_build_sdist,
get_requires_for_build_wheel,
prepare_metadata_for_build_wheel)
def build_wheel(*a, **kw):
# Create the marker file to record that the hook was called
with open(os.environ['PIP_TEST_MARKER_FILE'], 'wb'):
pass
return setuptools_build_wheel(*a, **kw)

View File

@ -0,0 +1,4 @@
[build-system]
requires = [ "setuptools" ]
build-backend = "mybuildsys" # setuptools.build_meta
backend-path = ["."]

View File

@ -0,0 +1,3 @@
[metadata]
name = pep517-wrapper-buildsys
version = 1.0

View File

@ -0,0 +1,3 @@
from setuptools import setup
setup()

View File

@ -1339,6 +1339,21 @@ def test_install_no_binary_builds_pep_517_wheel(script, data, with_wheel):
assert "Running setup.py install for pep517-set" not in str(res), str(res)
@pytest.mark.network
def test_install_no_binary_uses_local_backend(
script, data, with_wheel, tmpdir):
to_install = data.packages.joinpath('pep517_wrapper_buildsys')
script.environ['PIP_TEST_MARKER_FILE'] = marker = str(tmpdir / 'marker')
res = script.pip(
'install', '--no-binary=:all:', '-f', data.find_links, to_install
)
expected = "Successfully installed pep517-wrapper-buildsys"
# Must have installed the package
assert expected in str(res), str(res)
assert os.path.isfile(marker), "Local PEP 517 backend not used"
def test_install_no_binary_disables_cached_wheels(script, data, with_wheel):
# Seed the cache
script.pip(