Skip to content

Commit 0209101

Browse files
author
Sergei Zobov
committed
Update tests/test_cli_compile.py:test_error_in_pyproject_toml
To check only one action: either run in verbose or non-verbose mode
1 parent 1a0759c commit 0209101

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

tests/test_cli_compile.py

+18-9
Original file line numberDiff line numberDiff line change
@@ -2582,7 +2582,10 @@ def test_input_formats(fake_dists, runner, make_module, fname, content):
25822582
assert "extra ==" not in out.stderr
25832583

25842584

2585-
def test_error_in_pyproject_toml(fake_dists, runner, make_module, capfd):
2585+
@pytest.mark.parametrize("verbose_option", (True, False))
2586+
def test_error_in_pyproject_toml(
2587+
fake_dists, runner, make_module, capfd, verbose_option
2588+
):
25862589
"""
25872590
Test that an error in pyproject.toml is reported.
25882591
"""
@@ -2594,17 +2597,23 @@ def test_error_in_pyproject_toml(fake_dists, runner, make_module, capfd):
25942597
"""
25952598
)
25962599
meta_path = make_module(fname=fname, content=invalid_content)
2597-
out = runner.invoke(
2598-
cli, ["-n", "--no-build-isolation", "--find-links", fake_dists, meta_path]
2599-
)
2600-
assert out.exit_code == 2, out.stderr
2601-
assert "`project` must contain ['name'] properties" not in capfd.readouterr().err
2602-
out = runner.invoke(
2603-
cli, ["-n", "--no-build-isolation", "-v", "--find-links", fake_dists, meta_path]
2600+
2601+
options = []
2602+
if verbose_option:
2603+
options = ["--verbose"]
2604+
2605+
options.extend(
2606+
["-n", "--no-build-isolation", "--find-links", fake_dists, meta_path]
26042607
)
2608+
2609+
out = runner.invoke(cli, options)
2610+
26052611
assert out.exit_code == 2, out.stderr
26062612
captured = capfd.readouterr()
2607-
assert "`project` must contain ['name'] properties" in captured.err
2613+
2614+
assert (
2615+
"`project` must contain ['name'] properties" in captured.err
2616+
) is verbose_option
26082617

26092618

26102619
@pytest.mark.network

0 commit comments

Comments
 (0)