Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure pyproject.toml accepts UTF-8 in maintainers #3666

Merged
merged 1 commit into from
Nov 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions setuptools/tests/config/test_apply_pyprojecttoml.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ def test_apply_pyproject_equivalent_to_setupcfg(url, monkeypatch, tmp_path):
{name = "Tzu-Ping Chung"}
]
maintainers = [
{name = "Brett Cannon", email = "[email protected]"}
{name = "Brett Cannon", email = "[email protected]"},
{name = "John X. Ãørçeč", email = "[email protected]"},
{name = "Γαμα קּ 東", email = "[email protected]"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it'd handle IDNs as well. I'd add a test case for that too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@abravalheri turned out that the international emails aren't supported in the stdlib, so I thought it'd be reasonable to document that as an xfailing test case: #3670.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much @webknjaz

]
classifiers = [
"Development Status :: 4 - Beta",
Expand Down Expand Up @@ -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 ---")
Expand Down Expand Up @@ -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 <[email protected]>, "John X. Ãørçeč" <[email protected]>, '
'Γαμα קּ 東 <[email protected]>'
)
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):
Expand Down