summaryrefslogtreecommitdiff
path: root/pbr/tests/test_packaging.py
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2021-06-24 08:24:30 -0400
committerClark Boylan <clark.boylan@gmail.com>2021-11-03 10:05:32 -0700
commit09ee15341014fc0e3bb8a7c3b06a3fa912cfad38 (patch)
tree565f7ec56e003422a25701d757b2a412b07dd07a /pbr/tests/test_packaging.py
parent8c0d5c314108c09bbb3004d608a5a95bd81b8820 (diff)
downloadpbr-f6b6bd3d1b5a9648825b232551dfbb0b1bf239cc.tar.gz
Add a PEP517 interface5.7.0
pep517 defines a new module method of specifying build backends. To allow pbr to exist in this world, we should define the interface that's needed. For this to be used, one will put: [build-system] requires = ["pbr>=5.7.0", "setuptools>=36.6.0", "wheel"] build-backend = "pbr.build" Into pyproject.toml - and the pep517 interface will be used. This doesn't really change anything else - it just makes us support this. So by itself this commit isn't SUPER helpful. But maybe let's take baby steps with something this prone to strife, yeah? After this we can start teasing some things apart and doing our own things directly. Co-Authored-By: Clark Boylan <clark.boylan@gmail.com> Change-Id: I293f59b5074a38c78adffe580de2f1533bb01ce7
Diffstat (limited to 'pbr/tests/test_packaging.py')
-rw-r--r--pbr/tests/test_packaging.py52
1 files changed, 51 insertions, 1 deletions
diff --git a/pbr/tests/test_packaging.py b/pbr/tests/test_packaging.py
index 5d64b98..7d55d54 100644
--- a/pbr/tests/test_packaging.py
+++ b/pbr/tests/test_packaging.py
@@ -172,7 +172,7 @@ class Venv(fixtures.Fixture):
"""
self._reason = reason
if modules == ():
- modules = ['pip', 'wheel', PBR_ROOT]
+ modules = ['pip', 'wheel', 'build', PBR_ROOT]
self.modules = modules
if pip_cmd is None:
self.pip_cmd = ['-m', 'pip', '-v', 'install']
@@ -922,6 +922,56 @@ class TestRequirementParsing(base.BaseTestCase):
self.assertEqual(exp_parsed, gen_parsed)
+class TestPEP517Support(base.BaseTestCase):
+ def test_pep_517_support(self):
+ pkgs = {
+ 'test_pep517':
+ {
+ 'requirements.txt': textwrap.dedent("""\
+ sphinx
+ iso8601
+ """),
+ # Override no setup.py.
+ 'setup.py': '',
+ 'setup.cfg': textwrap.dedent("""\
+ [metadata]
+ name = test_pep517
+ summary = A tiny test project
+ author = PBR Team
+ author-email = foo@example.com
+ home-page = https://example.com/
+ classifier =
+ Intended Audience :: Information Technology
+ Intended Audience :: System Administrators
+ License :: OSI Approved :: Apache Software License
+ Operating System :: POSIX :: Linux
+ Programming Language :: Python
+ Programming Language :: Python :: 2
+ Programming Language :: Python :: 2.7
+ Programming Language :: Python :: 3
+ Programming Language :: Python :: 3.6
+ Programming Language :: Python :: 3.7
+ Programming Language :: Python :: 3.8
+ """),
+ 'pyproject.toml': textwrap.dedent("""\
+ [build-system]
+ requires = ["pbr", "setuptools>=36.6.0", "wheel"]
+ build-backend = "pbr.build"
+ """)},
+ }
+ pkg_dirs = self.useFixture(CreatePackages(pkgs)).package_dirs
+ pkg_dir = pkg_dirs['test_pep517']
+ venv = self.useFixture(Venv('PEP517'))
+
+ # Test building sdists and wheels works. Note we do not use pip here
+ # because pip will forcefully install the latest version of PBR on
+ # pypi to satisfy the build-system requires. This means we can't self
+ # test changes using pip. Build with --no-isolation appears to avoid
+ # this problem.
+ self._run_cmd(venv.python, ('-m', 'build', '--no-isolation', '.'),
+ allow_fail=False, cwd=pkg_dir)
+
+
class TestRepositoryURLDependencies(base.BaseTestCase):
def setUp(self):