diff --git "a/tests/samples/packageunicode/packageunicode/No\303\253l.jpg" "b/tests/samples/packageunicode/packageunicode/No\303\253l.jpg" new file mode 100644 index 00000000..7a8aaf96 Binary files /dev/null and "b/tests/samples/packageunicode/packageunicode/No\303\253l.jpg" differ diff --git a/tests/samples/packageunicode/packageunicode/__init__.py b/tests/samples/packageunicode/packageunicode/__init__.py new file mode 100644 index 00000000..cfb6bd6c --- /dev/null +++ b/tests/samples/packageunicode/packageunicode/__init__.py @@ -0,0 +1,5 @@ +""" +Short Description +""" + +__version__ = "1.0.0" diff --git a/tests/samples/packageunicode/pyproject.toml b/tests/samples/packageunicode/pyproject.toml new file mode 100644 index 00000000..524ac631 --- /dev/null +++ b/tests/samples/packageunicode/pyproject.toml @@ -0,0 +1,9 @@ +[build-system] +requires = ["flit_core >=2,<4"] +build-backend = "flit_core.buildapi" + +[tool.flit.metadata] +module = "packageunicode" +author = "Sir Robin" +author-email = "robin@camelot.uk" +home-page = "http://github.com/sirrobin/package2" diff --git a/tests/test_build.py b/tests/test_build.py index c17ba649..7d2e7f77 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + from pathlib import Path import pytest import shutil @@ -12,6 +14,7 @@ LIST_FILES_TEMPLATE = """\ #!{python} +# -*- coding: utf-8 -*- import sys from os.path import join if '--deleted' not in sys.argv: @@ -69,3 +72,22 @@ def test_build_module_no_docstring(): with pytest.raises(common.NoDocstringError) as exc_info: build.main(pyproject) assert 'no_docstring.py' in str(exc_info.value) + +def test_build_package_with_unicode(copy_sample): + list_files_template = """\ +#!{python} +# -*- coding: utf-8 -*- +import sys +from os.path import join +if '--deleted' not in sys.argv: + files = ['pyproject.toml', 'packageunicode/__init__.py', 'packageunicode/Noël.jpg'] + print('\\0'.join(files), end='\\0') +""" + td = copy_sample('packageunicode') + (td / '.git').mkdir() # Fake a git repo + + with MockCommand('git', list_files_template.format(python=sys.executable)): + res = build.main(td / 'pyproject.toml', formats={'sdist'}) + + # Compare str path to work around pathlib/pathlib2 mismatch on Py 3.5 + assert [str(p) for p in (td / 'dist').iterdir()] == [str(res.sdist.file)]