From b0196560fceca41460a3580a295e04703a9c6156 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Tue, 12 Mar 2024 16:58:16 +0100 Subject: [PATCH] Update CI [noissue] --- .bumpversion.cfg | 4 +-- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 4 +-- pulp-glue-ostree/pyproject.toml | 40 +++++++++++++++++++++++++++ pulp-glue-ostree/setup.py | 44 ------------------------------ pyproject.toml | 48 +++++++++++++++++++++++++++++++-- setup.py | 43 ----------------------------- tests/test_help_pages.py | 25 ++++++++++------- 8 files changed, 107 insertions(+), 103 deletions(-) delete mode 100644 pulp-glue-ostree/setup.py delete mode 100644 setup.py diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 6882526..d928b74 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -16,6 +16,6 @@ values = [bumpversion:file:./pulpcore/cli/ostree/__init__.py] -[bumpversion:file:./pulp-glue-ostree/setup.py] +[bumpversion:file:./pulp-glue-ostree/pyproject.toml] -[bumpversion:file:./setup.py] +[bumpversion:file:./pyproject.toml] diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d1a1f00..345e584 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,8 +10,8 @@ jobs: fail-fast: false matrix: python: - - "3.8" - "3.11" + - "3.12" steps: - uses: "actions/checkout@v4" - uses: "actions/cache@v4" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5dfd382..b3198ec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,10 +19,10 @@ jobs: - python: "3.11" image_tag: "nightly" pulp_api_root: "/relocated/djnd/" - - python: "3.6" + - python: "3.8" image_tag: "3.28" lower_bounds: true - - python: "3.7" + - python: "3.12" image_tag: "3.26" - python: "3.8" image_tag: "3.25" diff --git a/pulp-glue-ostree/pyproject.toml b/pulp-glue-ostree/pyproject.toml index e0559de..b31633d 100644 --- a/pulp-glue-ostree/pyproject.toml +++ b/pulp-glue-ostree/pyproject.toml @@ -1,3 +1,43 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "pulp-glue-ostree" +version = "0.3.0.dev" +description = "Version agnostic glue library to talk to pulpcore's REST API. (OSTree plugin)" +readme = "README.md" +requires-python = ">=3.8" +license = {text = "GPLv2+"} +authors = [ + {name = "Pulp Team", email = "pulp-list@redhat.com"}, +] +classifiers = [ + "Development Status :: 4 - Beta", + "Environment :: Other Environment", + "Intended Audience :: Developers", + "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Topic :: System :: Software Distribution", + "Typing :: Typed", +] +dependencies = [ + "pulp-glue>=0.20.0,<0.25", +] + +[project.urls] +repository = "https://github.com/pulp/pulp-cli-ostree" +changelog = "https://github.com/pulp/pulp-cli-ostree/blob/main/CHANGES.md" + +[tool.setuptools.packages.find] +where = ["."] +include = ["pulp_glue.*"] +namespaces = true + +[tool.setuptools.package-data] +"*" = ["py.typed", "locale/*/LC_MESSAGES/*.mo"] + [tool.black] line-length = 100 diff --git a/pulp-glue-ostree/setup.py b/pulp-glue-ostree/setup.py deleted file mode 100644 index 87ee381..0000000 --- a/pulp-glue-ostree/setup.py +++ /dev/null @@ -1,44 +0,0 @@ -from setuptools import setup - -try: - from setuptools import find_namespace_packages - - plugin_packages = find_namespace_packages(include=["pulp_glue.*"], exclude=["pulp_glue.*.*"]) - -except ImportError: - # Old versions of setuptools do not provide `find_namespace_packages` - # see https://github.com/pulp/pulp-cli/issues/248 - from setuptools import find_packages - - plugins = find_packages(where="pulp_glue") - plugin_packages = [f"pulp_glue.{plugin}" for plugin in plugins] - -long_description = "" -with open("README.md") as readme: - for line in readme: - long_description += line - -setup( - name="pulp-glue-ostree", - description="Version agnostic glue library to talk to pulpcore's REST API.", - long_description=long_description, - long_description_content_type="text/markdown", - author="Pulp Team", - url="https://github.com/pulp/pulp-cli-ostree", - version="0.3.0.dev", - packages=plugin_packages, - package_data={"": ["py.typed"]}, - python_requires=">=3.6", - install_requires=["pulp-glue>=0.20.0"], - license="GPLv2+", - classifiers=[ - "Development Status :: 4 - Beta", - "Environment :: Console", - "Intended Audience :: System Administrators", - "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3", - "Topic :: System :: Software Distribution", - "Typing :: Typed", - ], -) diff --git a/pyproject.toml b/pyproject.toml index b63943c..a37e947 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,47 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "pulp-cli-ostree" +version = "0.3.0.dev" +description = "Command line interface to talk to pulpcore's REST API. (OSTree plugin commands)" +readme = "README.md" +requires-python = ">=3.8" +license = {text = "GPLv2+"} +authors = [ + {name = "Pulp Team", email = "pulp-list@redhat.com"}, +] +classifiers=[ + "Development Status :: 4 - Beta", + "Environment :: Console", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Topic :: System :: Software Distribution", + "Typing :: Typed", +] +dependencies = [ + "pulp-cli>=0.20.0,<0.25", + "pulp-glue-ostree==0.3.0.dev", +] + +[project.urls] +repository = "https://github.com/pulp/pulp-cli-ostree" +changelog = "https://github.com/pulp/pulp-cli-ostree/blob/main/CHANGES.md" + +[project.entry-points."pulp_cli.plugins"] +ostree = "pulpcore.cli.ostree" + +[tool.setuptools.packages.find] +where = ["."] +include = ["pulpcore.cli.*"] +namespaces = true + +[tool.setuptools.package-data] +"*" = ["py.typed", "locale/*/LC_MESSAGES/*.mo"] + [tool.pulp_cli_template] app_label = "ostree" glue = true @@ -7,10 +51,10 @@ test_matrix = """ - python: "3.11" image_tag: "nightly" pulp_api_root: "/relocated/djnd/" -- python: "3.6" +- python: "3.8" image_tag: "3.28" lower_bounds: true -- python: "3.7" +- python: "3.12" image_tag: "3.26" - python: "3.8" image_tag: "3.25" diff --git a/setup.py b/setup.py deleted file mode 100644 index 97fea75..0000000 --- a/setup.py +++ /dev/null @@ -1,43 +0,0 @@ -from setuptools import setup - -try: - from setuptools import find_namespace_packages - - plugin_packages = find_namespace_packages(include=["pulpcore.cli.*"]) - -except ImportError: - # Old versions of setuptools do not provide `find_namespace_packages` - # see https://github.com/pulp/pulp-cli/issues/248 - from setuptools import find_packages - - plugins = find_packages(where="pulpcore/cli") - plugin_packages = [f"pulpcore.cli.{plugin}" for plugin in plugins] - -plugin_entry_points = [(package.rsplit(".", 1)[-1], package) for package in plugin_packages] - - -setup( - name="pulp-cli-ostree", - description="Command line interface to talk to pulpcore's REST API. (OSTree plugin commands)", - author="Pulp Team", - url="https://github.com/pulp/pulp-cli-ostree", - version="0.3.0.dev", - packages=plugin_packages, - package_data={package: ["py.typed"] for package in plugin_packages}, - python_requires=">=3.6", - install_requires=["pulp-cli>=0.20.0", "pulp-glue-ostree==0.3.0.dev"], - entry_points={ - "pulp_cli.plugins": [f"{name}={module}" for name, module in plugin_entry_points], - }, - license="GPLv2+", - classifiers=[ - "Development Status :: 4 - Beta", - "Environment :: Console", - "Intended Audience :: System Administrators", - "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", - "Operating System :: OS Independent", - "Programming Language :: Python :: 3", - "Topic :: System :: Software Distribution", - "Typing :: Typed", - ], -) diff --git a/tests/test_help_pages.py b/tests/test_help_pages.py index 60fccf4..44af4d3 100644 --- a/tests/test_help_pages.py +++ b/tests/test_help_pages.py @@ -1,14 +1,17 @@ -# type: ignore +import typing as t import click import pytest from click.testing import CliRunner -from pulp_cli import load_plugins +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 -main = load_plugins() +load_plugins() -def traverse_commands(command, args): +def traverse_commands(command: click.Command, args: t.List[str]) -> t.Iterator[t.List[str]]: yield args if isinstance(command, click.Group): @@ -19,6 +22,7 @@ def traverse_commands(command, args): if params: if "--type" in params[0].opts: # iterate over commands with specific context types + assert isinstance(params[0].type, click.Choice) for context_type in params[0].type.choices: yield args + ["--type", context_type] @@ -27,19 +31,22 @@ def traverse_commands(command, args): @pytest.fixture -def no_api(monkeypatch): - @property - def getter(self): +def no_api(monkeypatch: pytest.MonkeyPatch) -> None: + @property # type: ignore + def getter(self: t.Any) -> None: pytest.fail("Invalid access to 'PulpContext.api'.", pytrace=False) monkeypatch.setattr("pulp_glue.common.context.PulpContext.api", getter) @pytest.mark.help_page -def test_access_help(no_api, subtests): +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.") + runner = CliRunner() - for args in traverse_commands(main, []): + for args in traverse_commands(main.commands["ostree"], ["ostree"]): with subtests.test(msg=" ".join(args)): result = runner.invoke(main, args + ["--help"], catch_exceptions=False)