Voice et bot modif

This commit is contained in:
pi 2026-06-16 17:09:34 +00:00
parent 189d56026b
commit 7333a22bcd
10774 changed files with 634644 additions and 933308 deletions

View file

@ -535,9 +535,14 @@ class TestPyModules:
class TestExtModules:
def make_dist(self, toml_config):
pyproject = Path("pyproject.toml")
pyproject.write_text(cleandoc(toml_config), encoding="utf-8")
with pytest.warns(pyprojecttoml._ExperimentalConfiguration):
return pyprojecttoml.apply_configuration(Distribution({}), pyproject)
def test_pyproject_sets_attribute(self, tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
pyproject = Path("pyproject.toml")
toml_config = """
[project]
name = "test"
@ -547,13 +552,28 @@ class TestExtModules:
{name = "my.ext", sources = ["hello.c", "world.c"]}
]
"""
pyproject.write_text(cleandoc(toml_config), encoding="utf-8")
with pytest.warns(pyprojecttoml._ExperimentalConfiguration):
dist = pyprojecttoml.apply_configuration(Distribution({}), pyproject)
dist = self.make_dist(toml_config)
assert len(dist.ext_modules) == 1
assert dist.ext_modules[0].name == "my.ext"
assert set(dist.ext_modules[0].sources) == {"hello.c", "world.c"}
def test_pyproject_define_macros_as_tuples(self, tmp_path, monkeypatch):
# https://github.com/pypa/setuptools/issues/4810
monkeypatch.chdir(tmp_path)
toml_config = """
[project]
name = "test"
version = "42.0"
[[tool.setuptools.ext-modules]]
name = "my.ext"
sources = ["hello.c", "world.c"]
define-macros = [["FIRST_SINGLE"], ["SECOND_TWO", "1"]]
"""
dist = self.make_dist(toml_config)
assert isinstance(dist.ext_modules[0].define_macros[0], tuple)
assert dist.ext_modules[0].define_macros[0] == ("FIRST_SINGLE",)
assert dist.ext_modules[0].define_macros[1] == ("SECOND_TWO", "1")
class TestDeprecatedFields:
def test_namespace_packages(self, tmp_path):

View file

@ -286,6 +286,29 @@ class TestClassifiers:
assert "classifiers" not in expanded["project"]
class TestImportNames:
EXAMPLES = [
'import-names = ["hello", "world"]',
'import-namespaces = ["hello", "world"]',
'dynamic = ["import-names"]',
'dynamic = ["import-namespaces"]',
]
@pytest.mark.parametrize("example", EXAMPLES)
def test_not_implemented(self, monkeypatch, tmp_path, example):
monkeypatch.chdir(tmp_path)
pyproject = Path("pyproject.toml")
toml_config = f"""
[project]
name = 'proj'
version = '42'
{example}
"""
pyproject.write_text(cleandoc(toml_config), encoding="utf-8")
with pytest.raises(NotImplementedError, match='import-names'):
apply_configuration(Distribution({}), pyproject)
@pytest.mark.parametrize(
"example",
(