Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
include:
- image_tag: "nightly"
pulp_api_root: "/relocated/djnd/"
python: "3.11"
python: "3.14"
upper_bounds: true
- image_tag: "latest"
lower_bounds: true
pulp_https: true
python: "3.8"
python: "3.10"
steps:
- uses: "actions/checkout@v5"
- uses: "actions/cache@v4"
Expand Down
2 changes: 1 addition & 1 deletion pulp-glue-gem/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "pulp-glue-gem"
version = "0.6.0.dev"
description = "Version agnostic glue library to talk to pulpcore's REST API. (Gem plugin)"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.10"
license = {text = "GPLv2+"}
authors = [
{name = "Pulp Team", email = "pulp-list@redhat.com"},
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "pulp-cli-gem"
version = "0.6.0.dev"
description = "Command line interface to talk to pulpcore's REST API. (Gem plugin commands)"
readme = "README.md"
requires-python = ">=3.8"
requires-python = ">=3.10"
license = {text = "GPLv2+"}
authors = [
{name = "Pulp Team", email = "pulp-list@redhat.com"},
Expand Down
3 changes: 1 addition & 2 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Test requirements
pytest>=7.0.0,<=8.4.2
pytest-subtests>=0.12.0,<=0.14.2
pytest>=7.0.0,<=9.1.0
python-gnupg==0.5.5
trustme>=1.1.0,<1.3
50 changes: 29 additions & 21 deletions tests/test_help_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from packaging.version import parse as parse_version
from pulp_cli import __version__ as PULP_CLI_VERSION
from pulp_cli import load_plugins, main
from pytest_subtests.plugin import SubTests

load_plugins()

Expand All @@ -30,6 +29,20 @@ def traverse_commands(command: click.Command, args: t.List[str]) -> t.Iterator[t
yield from traverse_commands(sub, args + ["--type", context_type, name])


def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
m = next(metafunc.definition.iter_markers("help_page"), None)
if m is not None and "base_cmd" in m.kwargs:
if parse_version(PULP_CLI_VERSION) < parse_version("0.24"):
pytest.skip("This test is incompatible with older cli versions.")
rel_main: click.Group = main
base_cmd = m.kwargs["base_cmd"]
for step in base_cmd:
sub = rel_main.commands[step]
assert isinstance(sub, click.Group)
rel_main = sub
metafunc.parametrize("args", traverse_commands(rel_main, base_cmd), ids=" ".join)


@pytest.fixture
def no_api(monkeypatch: pytest.MonkeyPatch) -> None:
@property # type: ignore
Expand All @@ -39,24 +52,19 @@ def getter(self: t.Any) -> None:
monkeypatch.setattr("pulp_glue.common.context.PulpContext.api", getter)


@pytest.mark.help_page
def test_access_help(no_api: None, subtests: SubTests) -> 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.")

@pytest.mark.help_page(base_cmd=["gem"])
def test_accessing_the_help_page_does_not_invoke_api(
no_api: None,
args: list[str],
) -> None:
runner = CliRunner()
for args in traverse_commands(main.commands["gem"], ["gem"]):
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:
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:")
Loading