Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-ansible-compat for openSUSE:Factory checked in at 2022-08-05 19:50:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-ansible-compat (Old) and /work/SRC/openSUSE:Factory/.python-ansible-compat.new.1521 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-ansible-compat" Fri Aug 5 19:50:32 2022 rev:5 rq:991659 version:2.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-ansible-compat/python-ansible-compat.changes 2022-06-23 10:23:59.707722043 +0200 +++ /work/SRC/openSUSE:Factory/.python-ansible-compat.new.1521/python-ansible-compat.changes 2022-08-05 19:51:03.445464401 +0200 @@ -1,0 +2,12 @@ +Thu Jul 28 20:45:45 UTC 2022 - Johannes Kastl <ka...@b1-systems.de> + +- update to 2.2.0: + * Minor Changes + - Allow installation of pre-released collections (#157) @ssbarnea + - Add support for python 3.11 (#155) @ssbarnea + * Bugfixes + - Refactor schema testing (#152) @ssbarnea + - Use jsonschema 4.6.0 (#153) @ssbarnea + - Avoid CryptographyDeprecationWarning from paramiko (#150) @ssbarnea + +------------------------------------------------------------------- Old: ---- ansible-compat-2.1.0.tar.gz New: ---- ansible-compat-2.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-ansible-compat.spec ++++++ --- /var/tmp/diff_new_pack.FYH37d/_old 2022-08-05 19:51:03.949465702 +0200 +++ /var/tmp/diff_new_pack.FYH37d/_new 2022-08-05 19:51:03.953465713 +0200 @@ -19,7 +19,7 @@ # only works with the python version which the package 'ansible' uses %define pythons python3 Name: python-ansible-compat -Version: 2.1.0 +Version: 2.2.0 Release: 0 Summary: Compatibility shim for Ansible 2.9 and newer License: MIT ++++++ ansible-compat-2.1.0.tar.gz -> ansible-compat-2.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/.github/workflows/release.yml new/ansible-compat-2.2.0/.github/workflows/release.yml --- old/ansible-compat-2.1.0/.github/workflows/release.yml 2022-05-23 18:11:08.000000000 +0200 +++ new/ansible-compat-2.2.0/.github/workflows/release.yml 2022-07-13 19:33:17.000000000 +0200 @@ -23,7 +23,7 @@ steps: - name: Switch to using Python 3.8 by default - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.8 - name: Install tox diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/.github/workflows/tox.yml new/ansible-compat-2.2.0/.github/workflows/tox.yml --- old/ansible-compat-2.1.0/.github/workflows/tox.yml 2022-05-23 18:11:08.000000000 +0200 +++ new/ansible-compat-2.2.0/.github/workflows/tox.yml 2022-07-13 19:33:17.000000000 +0200 @@ -40,44 +40,41 @@ steps: - name: Check out src from Git - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 # needed by setuptools-scm + - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + - name: Pre-commit cache uses: actions/cache@v2 with: path: ~/.cache/pre-commit - key: ${{ runner.os }}-${{ matrix.env.TOXENV }}-pre-commit-${{ hashFiles('setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml') }} + key: ${{ matrix.name }}-pre-commit-${{ hashFiles('setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml') }} + - name: Pip cache uses: actions/cache@v2 with: path: ~/.cache/pip - key: ${{ runner.os }}-${{ matrix.env.TOXENV }}-pip-${{ hashFiles('setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml') }} + key: ${{ matrix.name }}-pip-${{ hashFiles('setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml') }} + - name: Install tox - run: | - python3 -m pip install --upgrade tox + run: python3 -m pip install --upgrade tox + - name: Log installed dists - run: >- - python -m pip freeze --all - - name: >- - Initialize tox envs - run: >- - python -m - tox - --parallel auto - --parallel-live - --notest - --skip-missing-interpreters false - -vv + run: python -m pip freeze --all + + - name: Initialize tox envs + run: python -m tox --notest --skip-missing-interpreters false -vv env: ${{ matrix.env }} + - name: Test with tox - run: | - python -m tox --parallel auto --parallel-live + run: python -m tox --parallel auto --parallel-live env: ${{ matrix.env }} + - name: Archive logs uses: actions/upload-artifact@v2 with: @@ -85,8 +82,7 @@ path: .tox/**/log/ unit: - name: >- - ${{ matrix.tox_env }}@${{ matrix.os }} + name: ${{ matrix.name || matrix.tox_env }} runs-on: ${{ matrix.os }} strategy: # fail-fast: false @@ -97,38 +93,42 @@ # proof that we failed to catch a bug by not running it. Using # distribution should be prefferred instead of custom builds. matrix: + name: + # cannot use "," in name as it will break actions/cache + - py38 + tox_env: + - py38,py38-ansible29 python-version: - # keep list sorted as it determines UI order too - - 3.8 - - 3.9 - - "3.10" - # NOTE: Installing ansible under 3.10-dev is currently not - # NOTE: possible because compiling cffi explodes. + - "3.8" os: # https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners - ubuntu-20.04 # - windows-latest # - windows-2016 include: - - tox_env: py38 - os: ubuntu-20.04 - python-version: 3.8 - devel: true - - tox_env: py39 + # keep list sorted as it determines UI order too + # linux (py38 comes from matrix): + - name: py39 + tox_env: py39,py39-devel os: ubuntu-20.04 python-version: 3.9 - devel: true - - tox_env: py310 + - name: py310 + tox_env: py310,py310-devel os: ubuntu-20.04 python-version: "3.10" - devel: true - - tox_env: py38 + - name: py311 + tox_env: py311,py311-devel + os: ubuntu-20.04 + python-version: "~3.11.0-0" # see https://github.com/actions/setup-python/issues/213#issuecomment-1146676713 + # macos + - name: py38@macos + tox_env: py38,py38-ansible29 # 2.14(devel) does not support 3.8 os: macOS-latest python-version: 3.8 - - tox_env: py310 + - name: py310@macos + tox_env: py310,py310-devel os: macOS-latest python-version: "3.10" - devel: true env: TOX_PARALLEL_NO_SPINNER: 1 @@ -140,66 +140,50 @@ run: | sudo sysctl -w net.link.generic.system.hwcksum_tx=0 sudo sysctl -w net.link.generic.system.hwcksum_rx=0 + - uses: actions/checkout@v2 with: fetch-depth: 0 # needed by setuptools-scm + - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: >- - Log the currently selected Python - version info (${{ matrix.python-version }}) + + - name: Log the currently selected Python version info (${{ matrix.python-version }}) run: | python --version --version which python + - name: Pip cache uses: actions/cache@v2 with: path: ~/.cache/pip - key: ${{ runner.os }}-${{ matrix.tox_env }}-pip-${{ hashFiles('constraints.txt', 'setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml', 'pytest.ini') }} + key: ${{ runner.os }}-${{ matrix.name }}-pip-${{ hashFiles('constraints.txt', 'setup.cfg', 'tox.ini', 'pyproject.toml', '.pre-commit-config.yaml', 'pytest.ini') }} + - name: Install tox - run: | - python3 -m pip install --upgrade tox 'coverage[toml]' + run: python3 -m pip install --upgrade tox 'coverage[toml]' + - name: Log installed dists - run: >- - python3 -m pip freeze --all - - name: >- - Initialize tox envs - run: >- - python3 -m - tox - --parallel auto - --parallel-live - --notest - --skip-missing-interpreters false - -vv - env: - TOXENV: ${{ matrix.tox_env }},${{ matrix.tox_env }}-ansible29,${{ matrix.tox_env }}-ansible212 - # sequential run improves browsing experience (almost no speed impact) - - name: "Test with tox: ${{ matrix.tox_env }}-ansible29" - run: python3 -m tox - env: - TOXENV: ${{ matrix.tox_env }}-ansible29 - - name: "Test with tox: ${{ matrix.tox_env }}-ansible212" - run: python3 -m tox - env: - TOXENV: ${{ matrix.tox_env }}-ansible212 - - name: "Test with tox: ${{ matrix.tox_env }}-devel" - if: ${{ matrix.devel }} - run: | - python3 -m tox - env: - TOXENV: ${{ matrix.tox_env }}-devel + run: python3 -m pip freeze --all + + - name: Initialize tox envs + run: python3 -m tox --notest --skip-missing-interpreters false -vv -e ${{ matrix.tox_env }} + + - name: "Test with tox: ${{ matrix.tox_env }}" + run: python3 -m tox -e ${{ matrix.tox_env }} + - name: Combine coverage data # produce a single .coverage file at repo root run: coverage combine .tox/.coverage.* + - name: Upload coverage data uses: codecov/codecov-action@v1 with: name: ${{ matrix.tox_env }} fail_ci_if_error: true # optional (default = false) verbose: true # optional (default = false) + - name: Archive logs uses: actions/upload-artifact@v2 with: @@ -207,6 +191,7 @@ path: .tox/**/log/ # https://github.com/actions/upload-artifact/issues/123 continue-on-error: true + - name: Report junit failures uses: shyim/junit-report-annotations-action@3d2e5374f2b13e70f6f3209a21adfdbc42c466ae with: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/.pre-commit-config.yaml new/ansible-compat-2.2.0/.pre-commit-config.yaml --- old/ansible-compat-2.1.0/.pre-commit-config.yaml 2022-05-23 18:11:08.000000000 +0200 +++ new/ansible-compat-2.2.0/.pre-commit-config.yaml 2022-07-13 19:33:17.000000000 +0200 @@ -16,14 +16,14 @@ repos: - repo: https://github.com/pre-commit/mirrors-prettier # keep it before yamllint - rev: "v2.6.2" + rev: "v2.7.1" hooks: - id: prettier additional_dependencies: - prettier - prettier-plugin-toml - repo: https://github.com/pre-commit/pre-commit-hooks.git - rev: v4.2.0 + rev: v4.3.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace @@ -43,7 +43,7 @@ hooks: - id: codespell - repo: https://github.com/PyCQA/doc8 - rev: 0.11.1 + rev: 0.11.2 hooks: - id: doc8 - repo: https://github.com/adrienverge/yamllint.git @@ -61,7 +61,7 @@ # https://github.com/pre-commit/mirrors-isort/issues/9#issuecomment-624404082 - --filter-files - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 22.6.0 hooks: - id: black language_version: python3 @@ -77,7 +77,7 @@ - flake8-rst-docstrings>=0.2.3 - flake8-rst>=0.8.0 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.950 + rev: v0.961 hooks: - id: mypy # empty args needed in order to match mypy cli behavior @@ -91,9 +91,9 @@ - subprocess-tee>=0.3.5 - types-PyYAML - types-pkg_resources - - types-jsonschema + - types-jsonschema>=4.4.9 - repo: https://github.com/pycqa/pylint - rev: v2.13.8 + rev: v2.14.4 hooks: - id: pylint additional_dependencies: @@ -114,7 +114,7 @@ stages: - manual additional_dependencies: - - pip-tools>=6.5.1 + - pip-tools>=6.8.0 - id: pip-compile name: Check constraints files and requirements files: ^(setup\.py|setup\.cfg|requirements\.txt)$ @@ -122,4 +122,4 @@ entry: python -m piptools compile -q --extra docs --extra test --output-file=requirements.txt setup.cfg pass_filenames: false additional_dependencies: - - pip-tools>=6.5.1 + - pip-tools>=6.8.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/PKG-INFO new/ansible-compat-2.2.0/PKG-INFO --- old/ansible-compat-2.1.0/PKG-INFO 2022-05-23 18:11:29.260798700 +0200 +++ new/ansible-compat-2.2.0/PKG-INFO 2022-07-13 19:33:35.006466600 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: ansible-compat -Version: 2.1.0 +Version: 2.2.0 Summary: Ansible compatibility goodies Home-page: https://github.com/ansible-community/ansible-compat Author: Sorin Sbarnea @@ -25,6 +25,7 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: Implementation Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: Jython diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/requirements.txt new/ansible-compat-2.2.0/requirements.txt --- old/ansible-compat-2.1.0/requirements.txt 2022-05-23 18:11:08.000000000 +0200 +++ new/ansible-compat-2.2.0/requirements.txt 2022-07-13 19:33:17.000000000 +0200 @@ -16,6 +16,8 @@ # pytest babel==2.10.1 # via sphinx +build==0.8.0 + # via pip-tools certifi==2022.5.18.1 # via requests charset-normalizer==2.0.12 @@ -45,7 +47,7 @@ # via # myst-parser # sphinx -jsonschema==4.5.1 +jsonschema==4.6.0 # via ansible-compat (setup.cfg) livereload==2.6.3 # via sphinx-autobuild @@ -65,13 +67,14 @@ # via ansible-compat (setup.cfg) packaging==21.3 # via + # build # pytest # sphinx pathtools==0.1.2 # via sphinx-autobuild pep517==0.12.0 - # via pip-tools -pip-tools==6.6.1 + # via build +pip-tools==6.8.0 # via ansible-compat (setup.cfg) pluggy==1.0.0 # via pytest @@ -141,7 +144,9 @@ toml==0.10.2 # via pytest tomli==2.0.1 - # via pep517 + # via + # build + # pep517 tornado==6.1 # via # livereload diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/setup.cfg new/ansible-compat-2.2.0/setup.cfg --- old/ansible-compat-2.1.0/setup.cfg 2022-05-23 18:11:29.260798700 +0200 +++ new/ansible-compat-2.2.0/setup.cfg 2022-07-13 19:33:35.010466600 +0200 @@ -33,6 +33,7 @@ Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 Programming Language :: Python :: Implementation Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: Jython @@ -56,7 +57,7 @@ install_requires = PyYAML subprocess-tee >= 0.3.5 - jsonschema >= 4.5.1 + jsonschema >= 4.6.0 [options.extras_require] docs = diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/src/ansible_compat/runtime.py new/ansible-compat-2.2.0/src/ansible_compat/runtime.py --- old/ansible-compat-2.1.0/src/ansible_compat/runtime.py 2022-05-23 18:11:08.000000000 +0200 +++ new/ansible-compat-2.2.0/src/ansible_compat/runtime.py 2022-07-13 19:33:17.000000000 +0200 @@ -12,6 +12,7 @@ import packaging import subprocess_tee +from packaging.version import Version from ansible_compat.config import ( AnsibleConfig, @@ -36,6 +37,8 @@ CompletedProcess = subprocess.CompletedProcess _logger = logging.getLogger(__name__) +# regex to extract the first version from a collection range specifier +version_re = re.compile(":[>=<]*([^,]*)") class Runtime: @@ -79,6 +82,12 @@ self.isolated = isolated self.max_retries = max_retries self.environ = environ or os.environ.copy() + # Reduce noise from paramiko, unless user already defined PYTHONWARNINGS + # paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated + # https://github.com/paramiko/paramiko/issues/2038 + if "PYTHONWARNINGS" not in self.environ: + self.environ["PYTHONWARNINGS"] = "ignore::CryptographyDeprecationWarning" + if isolated: self.cache_dir = get_cache_dir(self.project_dir) self.config = AnsibleConfig() @@ -207,6 +216,13 @@ if force or self.version_in_range(upper="2.11"): cmd.append("--force") + # As ansible-galaxy install is not able to automatically determine + # if the range requires a pre-release, we need to manuall add the --pre + # flag when needed. + matches = version_re.search(collection) + if matches and Version(matches[1]).is_prerelease: + cmd.append("--pre") + if destination: cmd.extend(["-p", str(destination)]) cmd.append(f"{collection}") @@ -404,7 +420,7 @@ break else: if install: - self.install_collection(f"{name}:>={version}") + self.install_collection(f"{name}:>={version}" if version else name) self.require_collection(name=name, version=version, install=False) else: msg = f"Collection '{name}' not found in '{paths}'" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/src/ansible_compat/schema.py new/ansible-compat-2.2.0/src/ansible_compat/schema.py --- old/ansible-compat-2.1.0/src/ansible_compat/schema.py 2022-05-23 18:11:08.000000000 +0200 +++ new/ansible-compat-2.2.0/src/ansible_compat/schema.py 2022-07-13 19:33:17.000000000 +0200 @@ -1,13 +1,13 @@ """Utils for JSON Schema validation.""" import json from dataclasses import dataclass -from typing import Any, Deque, Dict, List, Mapping, Union +from typing import Any, Dict, List, Mapping, Sequence, Union import jsonschema from jsonschema.validators import validator_for -def to_path(schema_path: Deque[str]) -> str: +def to_path(schema_path: Sequence[Union[str, int]]) -> str: """Flatten a path to a dot delimited string. :param schema_path: The schema path @@ -16,7 +16,7 @@ return ".".join(str(index) for index in schema_path) -def json_path(absolute_path: Deque[str]) -> str: +def json_path(absolute_path: Sequence[Union[str, int]]) -> str: """Flatten a data path to a dot delimited string. :param absolute_path: The path @@ -121,7 +121,7 @@ schema_path=to_path(validation_error.schema_path), relative_schema=validation_error.schema, expected=validation_error.validator_value, - validator=validation_error.validator, + validator=str(validation_error.validator), found=str(validation_error.instance), ) errors.append(error) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/src/ansible_compat.egg-info/PKG-INFO new/ansible-compat-2.2.0/src/ansible_compat.egg-info/PKG-INFO --- old/ansible-compat-2.1.0/src/ansible_compat.egg-info/PKG-INFO 2022-05-23 18:11:28.000000000 +0200 +++ new/ansible-compat-2.2.0/src/ansible_compat.egg-info/PKG-INFO 2022-07-13 19:33:34.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: ansible-compat -Version: 2.1.0 +Version: 2.2.0 Summary: Ansible compatibility goodies Home-page: https://github.com/ansible-community/ansible-compat Author: Sorin Sbarnea @@ -25,6 +25,7 @@ Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: Implementation Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: Jython diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/src/ansible_compat.egg-info/SOURCES.txt new/ansible-compat-2.2.0/src/ansible_compat.egg-info/SOURCES.txt --- old/ansible-compat-2.1.0/src/ansible_compat.egg-info/SOURCES.txt 2022-05-23 18:11:29.000000000 +0200 +++ new/ansible-compat-2.2.0/src/ansible_compat.egg-info/SOURCES.txt 2022-07-13 19:33:34.000000000 +0200 @@ -51,6 +51,9 @@ test/test_schema.py test/assets/requirements-invalid-collection.yml test/assets/requirements-invalid-role.yml +test/assets/validate0_data.json +test/assets/validate0_expected.json +test/assets/validate0_schema.json test/collections/acme.broken/galaxy.yml test/collections/acme.goodies/galaxy.yml test/collections/acme.goodies/molecule/default/converge.yml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/src/ansible_compat.egg-info/requires.txt new/ansible-compat-2.2.0/src/ansible_compat.egg-info/requires.txt --- old/ansible-compat-2.1.0/src/ansible_compat.egg-info/requires.txt 2022-05-23 18:11:29.000000000 +0200 +++ new/ansible-compat-2.2.0/src/ansible_compat.egg-info/requires.txt 2022-07-13 19:33:34.000000000 +0200 @@ -1,6 +1,6 @@ PyYAML subprocess-tee>=0.3.5 -jsonschema>=4.5.1 +jsonschema>=4.6.0 [docs] sphinx-autobuild<1.0,>=0.7.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/test/assets/validate0_data.json new/ansible-compat-2.2.0/test/assets/validate0_data.json --- old/ansible-compat-2.1.0/test/assets/validate0_data.json 1970-01-01 01:00:00.000000000 +0100 +++ new/ansible-compat-2.2.0/test/assets/validate0_data.json 2022-07-13 19:33:17.000000000 +0200 @@ -0,0 +1 @@ +{ "environment": { "a": false, "b": true, "c": "foo" } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/test/assets/validate0_expected.json new/ansible-compat-2.2.0/test/assets/validate0_expected.json --- old/ansible-compat-2.1.0/test/assets/validate0_expected.json 1970-01-01 01:00:00.000000000 +0100 +++ new/ansible-compat-2.2.0/test/assets/validate0_expected.json 2022-07-13 19:33:17.000000000 +0200 @@ -0,0 +1,22 @@ +[ + { + "message": "False is not of type 'string'", + "data_path": "environment.a", + "json_path": "$.environment.a", + "schema_path": "properties.environment.additionalProperties.type", + "relative_schema": { "type": "string" }, + "expected": "string", + "validator": "type", + "found": "False" + }, + { + "message": "True is not of type 'string'", + "data_path": "environment.b", + "json_path": "$.environment.b", + "schema_path": "properties.environment.additionalProperties.type", + "relative_schema": { "type": "string" }, + "expected": "string", + "validator": "type", + "found": "True" + } +] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/test/assets/validate0_schema.json new/ansible-compat-2.2.0/test/assets/validate0_schema.json --- old/ansible-compat-2.1.0/test/assets/validate0_schema.json 1970-01-01 01:00:00.000000000 +0100 +++ new/ansible-compat-2.2.0/test/assets/validate0_schema.json 2022-07-13 19:33:17.000000000 +0200 @@ -0,0 +1,9 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "properties": { + "environment": { + "type": "object", + "additionalProperties": { "type": "string" } + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/test/test_schema.py new/ansible-compat-2.2.0/test/test_schema.py --- old/ansible-compat-2.1.0/test/test_schema.py 2022-05-23 18:11:08.000000000 +0200 +++ new/ansible-compat-2.2.0/test/test_schema.py 2022-07-13 19:33:17.000000000 +0200 @@ -1,14 +1,11 @@ """Tests for schema utilities.""" -from ansible_compat.schema import JsonSchemaError, validate +import json +import os +from typing import Any -schema = { - "$schema": "http://json-schema.org/draft-07/schema#", - "properties": { - "environment": {"type": "object", "additionalProperties": {"type": "string"}} - }, -} +import pytest -instance = {"environment": {"a": False, "b": True, "c": "foo"}} +from ansible_compat.schema import JsonSchemaError, validate expected_results = [ JsonSchemaError( @@ -34,15 +31,33 @@ ] -def test_schema() -> None: +def json_from_asset(file_name: str) -> Any: + """Load a json file from disk.""" + file_name = os.path.join(os.path.dirname(os.path.abspath(__file__)), file_name) + with open(file_name, encoding="utf-8") as f: + return json.load(f) + + +def jsonify(data: Any) -> Any: + """Convert object in JSON data structure.""" + return json.loads(json.dumps(data, default=vars)) + + +@pytest.mark.parametrize("index", range(1)) +def test_schema(index: int) -> None: """Test the schema validator.""" - results = validate(schema=schema, data=instance) + schema = json_from_asset(f"assets/validate{index}_schema.json") + data = json_from_asset(f"assets/validate{index}_data.json") + expected = json_from_asset(f"assets/validate{index}_expected.json") + # ensure we produce consistent results between runs for _ in range(1, 100): - new_results = validate(schema=schema, data=instance) - assert results == new_results, "inconsistent returns" - # print(result) - assert len(results) == len(expected_results) - assert sorted(results) == results, "multiple errors not sorted" - for i, result in enumerate(results): - assert result == expected_results[i] + found_errors = validate(schema=schema, data=data) + # ensure returned results are already sorted, as we assume our class + # knows how to sort itself + assert sorted(found_errors) == found_errors, "multiple errors not sorted" + + found_errors_json = jsonify(found_errors) + assert ( + found_errors_json == expected + ), f"inconsistent returns: {found_errors_json}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ansible-compat-2.1.0/tox.ini new/ansible-compat-2.2.0/tox.ini --- old/ansible-compat-2.1.0/tox.ini 2022-05-23 18:11:08.000000000 +0200 +++ new/ansible-compat-2.2.0/tox.ini 2022-07-13 19:33:17.000000000 +0200 @@ -4,9 +4,11 @@ lint packaging docs - py{39,38}-{ansible29,ansible212} - py310-{ansible212} - py{310,39,38}-devel + # matrix assumed current (implicit) is 2.13: + py38{,-ansible29} + py39{,-devel} + py310{,-devel} + py311{,-devel} isolated_build = true requires = setuptools >= 41.4.0 @@ -21,12 +23,17 @@ ansible29: ansible 2.9 ansible210: ansible-base 2.10 ansible212: ansible-core 2.12 + ansible213: ansible-core 2.12 deps = ansible29: ansible>=2.9,<2.10 ansible210: ansible-base>=2.10,<2.11 ansible212: ansible-core>=2.12,<2.13 + ansible213: ansible-core>=2.13,<2.14 devel: ansible-core @ git+https://github.com/ansible/ansible.git # GPLv3+ + # avoid installing ansible-core on -devel and on ansible29 envs: + !devel-!ansible29: ansible-core --editable .[test] + commands = ansible --version # We add coverage options but not making them mandatory as we do not want to force @@ -63,7 +70,7 @@ # locked basepython is needed because to keep constrains.txt predictable basepython = python3.9 deps = - pip-tools>=6.5.1 + pip-tools>=6.8.0 pre-commit>=2.6.0 setuptools>=51.1.1 skip_install = true