From 59550aaec3a21b127c914ca5db6dcebe2636cc4a Mon Sep 17 00:00:00 2001 From: Thomas Kluyver Date: Sat, 23 Nov 2019 18:45:09 +0000 Subject: [PATCH] Add an integration test of installing a project with a local PEP 517 backend --- .../pep517_wrapper_buildsys/mybuildsys.py | 15 +++++++++++++++ .../pep517_wrapper_buildsys/pyproject.toml | 4 ++++ .../packages/pep517_wrapper_buildsys/setup.cfg | 3 +++ .../packages/pep517_wrapper_buildsys/setup.py | 3 +++ tests/functional/test_install.py | 15 +++++++++++++++ 5 files changed, 40 insertions(+) create mode 100644 tests/data/packages/pep517_wrapper_buildsys/mybuildsys.py create mode 100644 tests/data/packages/pep517_wrapper_buildsys/pyproject.toml create mode 100644 tests/data/packages/pep517_wrapper_buildsys/setup.cfg create mode 100644 tests/data/packages/pep517_wrapper_buildsys/setup.py diff --git a/tests/data/packages/pep517_wrapper_buildsys/mybuildsys.py b/tests/data/packages/pep517_wrapper_buildsys/mybuildsys.py new file mode 100644 index 000000000..df391e96a --- /dev/null +++ b/tests/data/packages/pep517_wrapper_buildsys/mybuildsys.py @@ -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) diff --git a/tests/data/packages/pep517_wrapper_buildsys/pyproject.toml b/tests/data/packages/pep517_wrapper_buildsys/pyproject.toml new file mode 100644 index 000000000..94cbfb52d --- /dev/null +++ b/tests/data/packages/pep517_wrapper_buildsys/pyproject.toml @@ -0,0 +1,4 @@ +[build-system] +requires = [ "setuptools" ] +build-backend = "mybuildsys" # setuptools.build_meta +backend-path = ["."] diff --git a/tests/data/packages/pep517_wrapper_buildsys/setup.cfg b/tests/data/packages/pep517_wrapper_buildsys/setup.cfg new file mode 100644 index 000000000..c8336a1c0 --- /dev/null +++ b/tests/data/packages/pep517_wrapper_buildsys/setup.cfg @@ -0,0 +1,3 @@ +[metadata] +name = pep517-wrapper-buildsys +version = 1.0 diff --git a/tests/data/packages/pep517_wrapper_buildsys/setup.py b/tests/data/packages/pep517_wrapper_buildsys/setup.py new file mode 100644 index 000000000..606849326 --- /dev/null +++ b/tests/data/packages/pep517_wrapper_buildsys/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup() diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index ba7a0a55c..ffc3736ba 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -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(