Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions tests/test_help_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,25 @@ def getter(self: t.Any) -> None:


@pytest.mark.help_page
def test_access_help(no_api: None, subtests: pytest.Subtests) -> None:
def test_access_help(no_api: None) -> None:
"""Test, that all help screens are accessible without touching the api property."""
if parse_version(PULP_CLI_VERSION) < parse_version("0.24"):
pytest.skip("This test is incompatible with older cli versions.")

runner = CliRunner()
failures: t.List[str] = []
for args in traverse_commands(main.commands["workflow"], ["workflow"]):
with subtests.test(msg=" ".join(args)):
result = runner.invoke(main, args + ["--help"], catch_exceptions=False)

if result.exit_code == 2:
assert (
"not available in this context" in result.stdout
or "not available in this context" in result.stderr
)
else:
assert result.exit_code == 0
assert result.stdout.startswith("Usage:") or result.stdout.startswith(
"DeprecationWarning:"
)
result = runner.invoke(main, args + ["--help"], catch_exceptions=False)

if result.exit_code == 2:
if (
"not available in this context" not in result.stdout
and "not available in this context" not in result.stderr
):
failures.append(" ".join(args))
elif result.exit_code != 0 or not (
result.stdout.startswith("Usage:") or result.stdout.startswith("DeprecationWarning:")
):
failures.append(" ".join(args))

assert not failures, "Help screens failed for: " + ", ".join(failures)
Loading