Skip to content

Commit

Permalink
Capture expectations of issue 3781
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Jan 20, 2023
1 parent f23c915 commit 7d35a38
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions setuptools/tests/test_sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def test_sdist_with_latin1_encoded_filename(self):
"setup.cfg - long_description and version": """
[metadata]
name = testing
version = file: VERSION.txt
version = file: src/VERSION.txt
license_files = DOWHATYOUWANT
long_description = file: README.rst, USAGE.rst
""",
Expand All @@ -513,15 +513,25 @@ def test_sdist_with_latin1_encoded_filename(self):
license = {file = "DOWHATYOUWANT"}
dynamic = ["version"]
[tool.setuptools.dynamic]
version = {file = ["VERSION.txt"]}
version = {file = ["src/VERSION.txt"]}
""",
"pyproject.toml - directive with str instead of list": """
[project]
name = "testing"
readme = "USAGE.rst"
license = {file = "DOWHATYOUWANT"}
dynamic = ["version"]
[tool.setuptools.dynamic]
version = {file = "src/VERSION.txt"}
"""
}

@pytest.mark.parametrize("config", _EXAMPLE_DIRECTIVES.keys())
def test_add_files_referenced_by_config_directives(self, tmp_path, config):
config_file, _, _ = config.partition(" - ")
config_text = self._EXAMPLE_DIRECTIVES[config]
(tmp_path / 'VERSION.txt').write_text("0.42", encoding="utf-8")
(tmp_path / 'src').mkdir()
(tmp_path / 'src/VERSION.txt').write_text("0.42", encoding="utf-8")
(tmp_path / 'README.rst').write_text("hello world!", encoding="utf-8")
(tmp_path / 'USAGE.rst').write_text("hello world!", encoding="utf-8")
(tmp_path / 'DOWHATYOUWANT').write_text("hello world!", encoding="utf-8")
Expand All @@ -536,9 +546,10 @@ def test_add_files_referenced_by_config_directives(self, tmp_path, config):
with quiet():
cmd.run()

assert 'VERSION.txt' in cmd.filelist.files
assert 'src/VERSION.txt' in cmd.filelist.files
assert 'USAGE.rst' in cmd.filelist.files
assert 'DOWHATYOUWANT' in cmd.filelist.files
assert '/' not in cmd.filelist.files

def test_pyproject_toml_in_sdist(self, tmpdir):
"""
Expand Down

0 comments on commit 7d35a38

Please sign in to comment.