Skip to content

Commit

Permalink
Update tests/test_cli_compile.py:test_error_in_pyproject_toml
Browse files Browse the repository at this point in the history
To check only one action: either run in verbose or non-verbose mode
  • Loading branch information
Sergei Zobov committed Sep 5, 2023
1 parent e9105f3 commit 4557e7f
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions tests/test_cli_compile.py
Expand Up @@ -2582,7 +2582,10 @@ def test_input_formats(fake_dists, runner, make_module, fname, content):
assert "extra ==" not in out.stderr


def test_error_in_pyproject_toml(fake_dists, runner, make_module, capfd):
@pytest.mark.parametrize("verbose_option", (True, False))
def test_error_in_pyproject_toml(
fake_dists, runner, make_module, capfd, verbose_option
):
"""
Test that an error in pyproject.toml is reported.
"""
Expand All @@ -2594,17 +2597,23 @@ def test_error_in_pyproject_toml(fake_dists, runner, make_module, capfd):
"""
)
meta_path = make_module(fname=fname, content=invalid_content)
out = runner.invoke(
cli, ["-n", "--no-build-isolation", "--find-links", fake_dists, meta_path]
)
assert out.exit_code == 2, out.stderr
assert "`project` must contain ['name'] properties" not in capfd.readouterr().err
out = runner.invoke(
cli, ["-n", "--no-build-isolation", "-v", "--find-links", fake_dists, meta_path]

options = []
if verbose_option:
options = ["--verbose"]

options.extend(
["-n", "--no-build-isolation", "--find-links", fake_dists, meta_path]
)

out = runner.invoke(cli, options)

assert out.exit_code == 2, out.stderr
captured = capfd.readouterr()
assert "`project` must contain ['name'] properties" in captured.err

assert (
"`project` must contain ['name'] properties" in captured.err
) is verbose_option


@pytest.mark.network
Expand Down

0 comments on commit 4557e7f

Please sign in to comment.