diff --git a/.gitignore b/.gitignore index 234fb5b..ed761f6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ __pycache__/ build/ tests/cli.toml -pytest_pulp_cli/GPG-PRIVATE-KEY-fixture-signing +GPG-PRIVATE-KEY-fixture-signing site/ dist/ *.po~ diff --git a/Makefile b/Makefile index d156182..2455b0b 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ lint: ruff check --diff .ci/scripts/check_cli_dependencies.py .ci/scripts/check_click_for_mypy.py - MYPYPATH=pulp-glue-deb mypy + mypy cd pulp-glue-deb; mypy @echo "🙊 Code 🙈 LGTM 🙉 !" diff --git a/lint_requirements.txt b/lint_requirements.txt index f7e27d6..1246a40 100644 --- a/lint_requirements.txt +++ b/lint_requirements.txt @@ -1,5 +1,5 @@ # Lint requirements -ruff~=0.15.0 +ruff~=0.15.1 mypy~=1.19.1 shellcheck-py~=0.11.0.1 diff --git a/pulp-glue-deb/pyproject.toml b/pulp-glue-deb/pyproject.toml index 1525116..2f425be 100644 --- a/pulp-glue-deb/pyproject.toml +++ b/pulp-glue-deb/pyproject.toml @@ -47,6 +47,7 @@ strict = true warn_unused_ignores = false show_error_codes = true files = "pulp_glue/**/*.py, tests/**/*.py" +mypy_path = ["."] namespace_packages = true explicit_package_bases = true diff --git a/pyproject.toml b/pyproject.toml index 73aee82..ae52c73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,6 +49,7 @@ namespaces = true # This section is co-managed by the cookiecutter templates. # Changes to existing keys should be preserved. app_label = "deb" +src_layout = false repository = "https://github.com/pulp/pulp-cli-deb" glue = true docs = false @@ -128,6 +129,7 @@ strict = true warn_unused_ignores = false show_error_codes = true files = "pulpcore/**/*.py, tests/*.py" +mypy_path = [".", "pulp-glue-deb"] namespace_packages = true explicit_package_bases = true @@ -205,4 +207,3 @@ extend-select = ["I"] sections = { second-party = ["pulp_glue"] } section-order = ["future", "standard-library", "third-party", "second-party", "first-party", "local-folder"] - diff --git a/tests/scripts/config.source b/tests/scripts/config.source index 2758992..cfa0a62 100644 --- a/tests/scripts/config.source +++ b/tests/scripts/config.source @@ -1,5 +1,7 @@ # Library for test helper functions +: "${PULP_API_ROOT:="/pulp/"}" + # open fd 3 as a copy of stderr exec 3<&2 @@ -46,10 +48,43 @@ expect_fail () { fi } -# Expects the provided test to pass -# Supresses all output, which is redirected to ASSERTION_OUTPUT and ASSERTION_ERROUTPUT so as not -# to overwrite the latest OUTPUT and ERROUTPUT, that way we can test several assertions in a row. +# Expects the command to report access denied +# Supresses all output, which is redirected to $OUTPUT and $ERROUTPUT # Reports verbosely on failure +expect_deny () { + if { + "$@" + } 1>log.out 2>log.err + # TODO check for access denied message + then + echo "FAILURE [! $@]" >&3 + echo "=== STDOUT ===" >&3 + cat log.out >&3 + echo "=== STDERR ===" >&3 + cat log.err >&3 + false + else + if grep -q "Operation .* not authorized." log.err + then + echo "SUCCESS [! $@]" >&3 + OUTPUT="$(cat log.out)" + ERROUTPUT="$(cat log.err)" + else + echo "FAILURE [! $@]" >&3 + echo "=== STDOUT ===" >&3 + cat log.out >&3 + echo "=== STDERR ===" >&3 + cat log.err >&3 + false + fi + fi +} + +# Expects the provided test to pass +# Supresses all output, which is redirected to ASSERTION_OUTPUT and +# ASSERTION_ERROUTPUT so as not to overwrite the latest OUTPUT and ERROUTPUT. +# That way we can test several assertions in a row. +# Reports verbosely on failure. assert () { if { [[ "$@" ]]