summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2022-11-10 11:03:21 +0000
committerGitHub <noreply@github.com>2022-11-10 11:03:21 +0000
commitf3de57ed0a0572a4e4525c9403ab72f333870d0b (patch)
treeb18ffda5a504ab2cac42a7c0586999d3dea00960
parent26e1e589b6c193d0d9d81e6890b5a6800fb88c9d (diff)
parentc53b4bbfdf5ed27a91cb7d2c5c457d896275f774 (diff)
downloadpython-setuptools-git-f3de57ed0a0572a4e4525c9403ab72f333870d0b.tar.gz
Ensure `pyproject.toml` accepts UTF-8 in maintainers (#3666)
-rw-r--r--setuptools/tests/config/test_apply_pyprojecttoml.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/setuptools/tests/config/test_apply_pyprojecttoml.py b/setuptools/tests/config/test_apply_pyprojecttoml.py
index 2194197f..7ad327bb 100644
--- a/setuptools/tests/config/test_apply_pyprojecttoml.py
+++ b/setuptools/tests/config/test_apply_pyprojecttoml.py
@@ -98,7 +98,9 @@ authors = [
{name = "Tzu-Ping Chung"}
]
maintainers = [
- {name = "Brett Cannon", email = "brett@python.org"}
+ {name = "Brett Cannon", email = "brett@python.org"},
+ {name = "John X. Ãørçeč", email = "john@utf8.org"},
+ {name = "Γαμα קּ 東", email = "gama@utf8.org"},
]
classifiers = [
"Development Status :: 4 - Beta",
@@ -147,7 +149,7 @@ def _pep621_example_project(tmp_path, readme="README.rst"):
replacements = {'readme = "README.rst"': f'readme = "{readme}"'}
for orig, subst in replacements.items():
text = text.replace(orig, subst)
- pyproject.write_text(text)
+ pyproject.write_text(text, encoding="utf-8")
(tmp_path / readme).write_text("hello world")
(tmp_path / "LICENSE.txt").write_text("--- LICENSE stub ---")
@@ -189,6 +191,21 @@ def test_no_explicit_content_type_for_missing_extension(tmp_path):
assert dist.metadata.long_description_content_type is None
+def test_utf8_maintainer_in_metadata(tmp_path): # issue-3663
+ pyproject = _pep621_example_project(tmp_path, "README")
+ dist = pyprojecttoml.apply_configuration(makedist(tmp_path), pyproject)
+ expected = (
+ 'Brett Cannon <brett@python.org>, "John X. Ãørçeč" <john@utf8.org>, '
+ 'Γαμα קּ 東 <gama@utf8.org>'
+ )
+ assert dist.metadata.maintainer_email == expected
+ pkg_file = tmp_path / "PKG-FILE"
+ with open(pkg_file, "w", encoding="utf-8") as fh:
+ dist.metadata.write_pkg_file(fh)
+ content = pkg_file.read_text(encoding="utf-8")
+ assert f"Maintainer-email: {expected}" in content
+
+
# TODO: After PEP 639 is accepted, we have to move the license-files
# to the `project` table instead of `tool.setuptools`
def test_license_and_license_files(tmp_path):