Skip to content

Commit 60b037e

Browse files
committed
Add unit test for ext-mopdules in pyproject.toml
1 parent 61f2906 commit 60b037e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

setuptools/tests/config/test_apply_pyprojecttoml.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,26 @@ def test_invalid_module_name(self, tmp_path, monkeypatch, module):
324324
self.dist(module).py_modules
325325

326326

327+
class TestExtModules:
328+
def test_pyproject_sets_attribute(self, tmp_path, monkeypatch):
329+
monkeypatch.chdir(tmp_path)
330+
pyproject = Path("pyproject.toml")
331+
toml_config = """
332+
[project]
333+
name = "test"
334+
version = "42.0"
335+
[tool.setuptools]
336+
ext-modules = [
337+
{name = "my.ext", sources = ["hello.c", "world.c"]}
338+
]
339+
"""
340+
pyproject.write_text(cleandoc(toml_config), encoding="utf-8")
341+
dist = pyprojecttoml.apply_configuration(Distribution({}), pyproject)
342+
assert len(dist.ext_modules) == 1
343+
assert dist.ext_modules[0].name == "my.ext"
344+
assert set(dist.ext_modules[0].sources) == {"hello.c", "world.c"}
345+
346+
327347
class TestDeprecatedFields:
328348
def test_namespace_packages(self, tmp_path):
329349
pyproject = tmp_path / "pyproject.toml"

0 commit comments

Comments
 (0)