Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/setuptools_scm/_integration/setuptools.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def read_dist_name_from_setup_cfg(
parser = configparser.ConfigParser()

if isinstance(input, (os.PathLike, str)):
parser.read([input])
parser.read([input], encoding="utf-8")
else:
parser.read_file(input)

Expand Down
18 changes: 18 additions & 0 deletions testing/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import pytest

import setuptools_scm._integration.setuptools
from .wd_wrapper import WorkDir
from setuptools_scm import PRETEND_KEY
from setuptools_scm import PRETEND_KEY_NAMED
Expand Down Expand Up @@ -152,3 +153,20 @@ def test_distribution_procides_extras() -> None:

dist = distribution("setuptools_scm")
assert sorted(dist.metadata.get_all("Provides-Extra")) == ["test", "toml"]


@pytest.mark.issue(760)
def test_unicode_in_setup_cfg(tmp_path: Path) -> None:
cfg = tmp_path / "setup.cfg"
cfg.write_text(
textwrap.dedent(
"""
[metadata]
name = configparser
author = Łukasz Langa
"""
),
encoding="utf-8",
)
name = setuptools_scm._integration.setuptools.read_dist_name_from_setup_cfg(cfg)
assert name == "configparser"