Skip to content

Commit 566f294

Browse files
committed
Test command line parsing of '--version' interoperates with pyproject.toml
1 parent 0120605 commit 566f294

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

setuptools/tests/config/test_apply_pyprojecttoml.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,25 @@ def test_example_file_not_in_wheel(self, setuptools_wheel):
423423
assert not any(name.endswith(EXAMPLES_FILE) for name in zipfile.namelist())
424424

425425

426+
class TestInteropCommandLineParsing:
427+
def test_version(self, tmp_path, monkeypatch, capsys):
428+
# See pypa/setuptools#4047
429+
# This test can be removed once the CLI interface of setup.py is removed
430+
monkeypatch.chdir(tmp_path)
431+
toml_config = """
432+
[project]
433+
name = "test"
434+
version = "42.0"
435+
"""
436+
pyproject = Path(tmp_path, "pyproject.toml")
437+
pyproject.write_text(cleandoc(toml_config), encoding="utf-8")
438+
opts = {"script_args": ["--version"]}
439+
dist = pyprojecttoml.apply_configuration(Distribution(opts), pyproject)
440+
dist.parse_command_line() # <-- there should be no exception here.
441+
captured = capsys.readouterr()
442+
assert "42.0" in captured.out
443+
444+
426445
# --- Auxiliary Functions ---
427446

428447

0 commit comments

Comments
 (0)