Skip to content

Commit 59550aa

Browse files
committed
Add an integration test of installing a project with a local PEP 517 backend
1 parent 400cf8d commit 59550aa

File tree

5 files changed

+40
-0
lines changed

5 files changed

+40
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import os
2+
3+
from setuptools.build_meta import build_sdist
4+
from setuptools.build_meta import build_wheel as setuptools_build_wheel
5+
from setuptools.build_meta import (get_requires_for_build_sdist,
6+
get_requires_for_build_wheel,
7+
prepare_metadata_for_build_wheel)
8+
9+
10+
def build_wheel(*a, **kw):
11+
# Create the marker file to record that the hook was called
12+
with open(os.environ['PIP_TEST_MARKER_FILE'], 'wb'):
13+
pass
14+
15+
return setuptools_build_wheel(*a, **kw)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[build-system]
2+
requires = [ "setuptools" ]
3+
build-backend = "mybuildsys" # setuptools.build_meta
4+
backend-path = ["."]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[metadata]
2+
name = pep517-wrapper-buildsys
3+
version = 1.0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from setuptools import setup
2+
3+
setup()

tests/functional/test_install.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,21 @@ def test_install_no_binary_builds_pep_517_wheel(script, data, with_wheel):
13391339
assert "Running setup.py install for pep517-set" not in str(res), str(res)
13401340

13411341

1342+
@pytest.mark.network
1343+
def test_install_no_binary_uses_local_backend(
1344+
script, data, with_wheel, tmpdir):
1345+
to_install = data.packages.joinpath('pep517_wrapper_buildsys')
1346+
script.environ['PIP_TEST_MARKER_FILE'] = marker = str(tmpdir / 'marker')
1347+
res = script.pip(
1348+
'install', '--no-binary=:all:', '-f', data.find_links, to_install
1349+
)
1350+
expected = "Successfully installed pep517-wrapper-buildsys"
1351+
# Must have installed the package
1352+
assert expected in str(res), str(res)
1353+
1354+
assert os.path.isfile(marker), "Local PEP 517 backend not used"
1355+
1356+
13421357
def test_install_no_binary_disables_cached_wheels(script, data, with_wheel):
13431358
# Seed the cache
13441359
script.pip(

0 commit comments

Comments
 (0)