Skip to content

Commit

Permalink
Add test capturing issue pypa#488 behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Nov 9, 2022
1 parent daeb157 commit 7b5dba0
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/test_bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import subprocess
import sys
import sysconfig
from unittest.mock import Mock, patch
from zipfile import ZipFile

import pytest
Expand Down Expand Up @@ -72,6 +73,38 @@ def test_unicode_record(wheel_paths):
assert "åäö_日本語.py".encode() in record


UTF8_PKG_INFO = """\
Metadata-Version: 2.1
Name: helloworld
Version: 42
Author-email: John X. Ãørçeč" <john@utf8.org>, Γαμα קּ 東 <gama@utf8.org>
UTF-8 描述 説明
"""


@patch("distutils.dist.Distribution", new=Mock)
def test_preserve_unicode_metadata(monkeypatch, tmp_path):
monkeypatch.chdir(tmp_path)
egginfo = tmp_path / "dummy_dist.egg-info"
distinfo = tmp_path / "dummy_dist.dist-info"

egginfo.mkdir()
(egginfo / "PKG-INFO").write_text(UTF8_PKG_INFO, encoding="utf-8")
(egginfo / "dependency_links.txt").touch()

metadata = Mock(license_files=[], get_option_dict=lambda: {})
dist = Mock(metadata=metadata)
cmd_obj = bdist_wheel(dist)
cmd_obj.egg2dist(egginfo, distinfo)

metadata = (distinfo / "METADATA").read_text(encoding="utf-8")
assert "John X. Ãørçeč" in metadata
assert "Γαμα קּ 東 " in metadata
assert "UTF-8 描述 説明" in metadata


def test_licenses_default(dummy_dist, monkeypatch, tmpdir):
monkeypatch.chdir(dummy_dist)
subprocess.check_call(
Expand Down

0 comments on commit 7b5dba0

Please sign in to comment.