Skip to content

Commit

Permalink
Test command line parsing of '--version' interoperates with pyproject…
Browse files Browse the repository at this point in the history
….toml
  • Loading branch information
abravalheri committed Sep 12, 2023
1 parent 0120605 commit 566f294
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions setuptools/tests/config/test_apply_pyprojecttoml.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,25 @@ def test_example_file_not_in_wheel(self, setuptools_wheel):
assert not any(name.endswith(EXAMPLES_FILE) for name in zipfile.namelist())


class TestInteropCommandLineParsing:
def test_version(self, tmp_path, monkeypatch, capsys):
# See pypa/setuptools#4047
# This test can be removed once the CLI interface of setup.py is removed
monkeypatch.chdir(tmp_path)
toml_config = """
[project]
name = "test"
version = "42.0"
"""
pyproject = Path(tmp_path, "pyproject.toml")
pyproject.write_text(cleandoc(toml_config), encoding="utf-8")
opts = {"script_args": ["--version"]}
dist = pyprojecttoml.apply_configuration(Distribution(opts), pyproject)
dist.parse_command_line() # <-- there should be no exception here.
captured = capsys.readouterr()
assert "42.0" in captured.out


# --- Auxiliary Functions ---


Expand Down

0 comments on commit 566f294

Please sign in to comment.