Skip to content

Commit 9185838

Browse files
committed
test: add test for building with unicode filenames
1 parent 5ed2484 commit 9185838

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed
11.1 KB
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""
2+
Short Description
3+
"""
4+
5+
__version__ = "1.0.0"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[build-system]
2+
requires = ["flit_core >=2,<4"]
3+
build-backend = "flit_core.buildapi"
4+
5+
[tool.flit.metadata]
6+
module = "packageunicode"
7+
author = "Sir Robin"
8+
author-email = "robin@camelot.uk"
9+
home-page = "http://github.com/sirrobin/package2"

tests/test_build.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
13
from pathlib import Path
24
import pytest
35
import shutil
@@ -12,6 +14,7 @@
1214

1315
LIST_FILES_TEMPLATE = """\
1416
#!{python}
17+
# -*- coding: utf-8 -*-
1518
import sys
1619
from os.path import join
1720
if '--deleted' not in sys.argv:
@@ -69,3 +72,22 @@ def test_build_module_no_docstring():
6972
with pytest.raises(common.NoDocstringError) as exc_info:
7073
build.main(pyproject)
7174
assert 'no_docstring.py' in str(exc_info.value)
75+
76+
def test_build_package_with_unicode(copy_sample):
77+
list_files_template = """\
78+
#!{python}
79+
# -*- coding: utf-8 -*-
80+
import sys
81+
from os.path import join
82+
if '--deleted' not in sys.argv:
83+
files = ['pyproject.toml', 'packageunicode/__init__.py', 'packageunicode/Noël.jpg']
84+
print('\\0'.join(files), end='\\0')
85+
"""
86+
td = copy_sample('packageunicode')
87+
(td / '.git').mkdir() # Fake a git repo
88+
89+
with MockCommand('git', list_files_template.format(python=sys.executable)):
90+
res = build.main(td / 'pyproject.toml', formats={'sdist'})
91+
92+
# Compare str path to work around pathlib/pathlib2 mismatch on Py 3.5
93+
assert [str(p) for p in (td / 'dist').iterdir()] == [str(res.sdist.file)]

0 commit comments

Comments
 (0)