Skip to content

Commit 9dccfa4

Browse files
committed
Moved pbr setup into a fixture.
1 parent af8b322 commit 9dccfa4

File tree

3 files changed

+55
-38
lines changed

3 files changed

+55
-38
lines changed

setuptools/tests/fixtures.py

+43
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import time
88
from pathlib import Path
99

10+
import jaraco.path
1011
import path
1112
import pytest
1213

@@ -347,3 +348,45 @@ def create_setup_requires_package(
347348
make_package(foobar_path, distname, version)
348349

349350
return test_pkg
351+
352+
353+
@pytest.fixture
354+
def pbr_package(tmp_path, monkeypatch, venv):
355+
files = {
356+
"pyproject.toml": DALS(
357+
"""
358+
[build-system]
359+
requires = ["setuptools"]
360+
build-backend = "setuptools.build_meta"
361+
"""
362+
),
363+
"setup.py": DALS(
364+
"""
365+
__import__('setuptools').setup(
366+
pbr=True,
367+
setup_requires=["pbr"],
368+
)
369+
"""
370+
),
371+
"setup.cfg": DALS(
372+
"""
373+
[metadata]
374+
name = mypkg
375+
376+
[files]
377+
packages =
378+
mypkg
379+
"""
380+
),
381+
"mypkg": {
382+
"__init__.py": "",
383+
"hello.py": "print('Hello world!')",
384+
},
385+
"other": {"test.txt": "Another file in here."},
386+
}
387+
venv.run(["python", "-m", "pip", "install", "pbr"])
388+
prefix = tmp_path / 'mypkg'
389+
prefix.mkdir()
390+
jaraco.path.build(files, prefix=prefix)
391+
monkeypatch.setenv('PBR_VERSION', "0.42")
392+
return prefix

setuptools/tests/integration/test_pbr.py

Whitespace-only changes.

setuptools/tests/test_editable_install.py

+12-38
Original file line numberDiff line numberDiff line change
@@ -1068,45 +1068,19 @@ def test_compat_install(tmp_path, venv):
10681068
assert "cannot import name 'subpackage'" in out
10691069

10701070

1071-
def test_pbr_integration(tmp_path, venv, editable_opts):
1071+
def test_pbr_integration(pbr_package, venv, editable_opts):
10721072
"""Ensure editable installs work with pbr, issue #3500"""
1073-
files = {
1074-
"pyproject.toml": dedent(
1075-
"""\
1076-
[build-system]
1077-
requires = ["setuptools"]
1078-
build-backend = "setuptools.build_meta"
1079-
"""
1080-
),
1081-
"setup.py": dedent(
1082-
"""\
1083-
__import__('setuptools').setup(
1084-
pbr=True,
1085-
setup_requires=["pbr"],
1086-
)
1087-
"""
1088-
),
1089-
"setup.cfg": dedent(
1090-
"""\
1091-
[metadata]
1092-
name = mypkg
1093-
1094-
[files]
1095-
packages =
1096-
mypkg
1097-
"""
1098-
),
1099-
"mypkg": {
1100-
"__init__.py": "",
1101-
"hello.py": "print('Hello world!')",
1102-
},
1103-
"other": {"test.txt": "Another file in here."},
1104-
}
1105-
venv.run(["python", "-m", "pip", "install", "pbr"])
1106-
1107-
with contexts.environment(PBR_VERSION="0.42"):
1108-
install_project("mypkg", venv, tmp_path, files, *editable_opts)
1109-
1073+
cmd = [
1074+
'python',
1075+
'-m',
1076+
'pip',
1077+
'-v',
1078+
'install',
1079+
'--editable',
1080+
pbr_package,
1081+
*editable_opts,
1082+
]
1083+
venv.run(cmd, stderr=subprocess.STDOUT)
11101084
out = venv.run(["python", "-c", "import mypkg.hello"])
11111085
assert "Hello world!" in out
11121086

0 commit comments

Comments
 (0)