Skip to content

Commit 721d2ee

Browse files
committed
Add test capturing expectation about importlib.metadata
1 parent 60a72a0 commit 721d2ee

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Name: _test_bootstrap
2+
Version: 0.0.1
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[_test_backend.importlib_metadata]
2+
hello = world
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from importlib.metadata import distribution
2+
3+
4+
def get_requires_for_build_sdist(config_settings):
5+
dist = distribution("_test_bootstrap") # discovered in backend-path
6+
ep = next(iter(dist.entry_points))
7+
return [ep.group, ep.name, ep.value]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
build-backend = 'intree_backend'
3+
backend-path = ['backend']

tests/test_inplace_hooks.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from inspect import cleandoc
23
from os.path import abspath, dirname
34
from os.path import join as pjoin
@@ -89,6 +90,16 @@ def test_intree_backend_loaded_from_correct_backend_path():
8990
assert res == ["intree_backend_called"]
9091

9192

93+
@pytest.mark.skipif(sys.version_info < (3, 8), reason="no importlib.metadata")
94+
def test_intree_backend_importlib_metadata_interoperation():
95+
hooks = get_hooks("pkg_intree_metadata", backend="intree_backend")
96+
assert hooks.get_requires_for_build_sdist({}) == [
97+
"_test_backend.importlib_metadata",
98+
"hello",
99+
"world",
100+
]
101+
102+
92103
def install_finder_with_sitecustomize(directory, mapping):
93104
finder = f"""
94105
import sys

0 commit comments

Comments
 (0)