diff --git a/ansible-lint.changes b/ansible-lint.changes index b5081b2..decc29c 100644 --- a/ansible-lint.changes +++ b/ansible-lint.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Sun May 29 11:07:05 UTC 2022 - Sebastian Wagner + +- Add deprecated-pytest-hook.patch to fix a test fail. + ------------------------------------------------------------------- Tue Feb 15 09:21:58 UTC 2022 - Sebastian Wagner diff --git a/ansible-lint.spec b/ansible-lint.spec index 2f4a568..95fb136 100644 --- a/ansible-lint.spec +++ b/ansible-lint.spec @@ -26,6 +26,7 @@ Summary: Best practices checker for Ansible License: MIT URL: https://github.com/ansible-community/ansible-lint Source0: https://github.com/ansible-community/ansible-lint/archive/v%{version}/ansible-lint-%{version}.tar.gz +Patch0: https://github.com/ansible/ansible-lint/commit/aa6c1c6577f8178643591ddc06996a5d5588cb9a.patch#/deprecated-pytest-hook.patch BuildArch: noarch BuildRequires: python-rpm-macros BuildRequires: python3-PyYAML @@ -40,11 +41,11 @@ BuildRequires: python3-tenacity BuildRequires: python3-yamllint #BuildRequires: git BuildRequires: python3-enrich >= 1.2.6 +BuildRequires: ansible BuildRequires: python3-rich >= 9.5.1 BuildRequires: python3-ruamel.yaml >= 0.15.37 BuildRequires: python3-wcmatch >= 7.0 # /SECTION -BuildRequires: ansible BuildRequires: fdupes Requires: ansible Requires: python3-PyYAML @@ -61,6 +62,7 @@ Checks playbooks for practices and behavior that could potentially be improved. %prep %setup -n ansible-lint-%{version} +%patch0 -p1 sed -ri 's/(\[metadata\])/\1\nversion = %{version}/' setup.cfg sed -i '1{/\/usr\/bin\/env python/d;}' src/ansiblelint/__main__.py @@ -78,7 +80,7 @@ python3 -O -m compileall %{buildroot}/%{python3_sitelib} %check # exclude some tests depending on internet access (galaxy modules) # exclude test_cli_auto_detect which depends on a local git repository -# exclude test_co and test_call_from_outside_venv because of https://github.com/ansible-community/ansible-lint/issues/1885 +# exclude test_co and test_call_from_outside_venv because of https://github.com/ansible-community/ansible-lint/issues/1885 FIXED! PYTHONPATH=${PYTHONPATH:+$PYTHONPATH:}%{buildroot}/%{python3_sitelib} PATH=${PATH:+$PATH:}%{buildroot}/%{_bindir} PYTHONDONTWRITEBYTECODE=1 pytest -v -k 'not (test_prerun_reqs_v1 or test_prerun_reqs_v2 or test_install_collection or test_require_collection_wrong_version or test_cli_auto_detect or test_eco or test_call_from_outside_venv)' %files diff --git a/deprecated-pytest-hook.patch b/deprecated-pytest-hook.patch new file mode 100644 index 0000000..081729b --- /dev/null +++ b/deprecated-pytest-hook.patch @@ -0,0 +1,54 @@ +From aa6c1c6577f8178643591ddc06996a5d5588cb9a Mon Sep 17 00:00:00 2001 +From: Sorin Sbarnea +Date: Sun, 13 Feb 2022 13:21:49 +0000 +Subject: [PATCH] Remove deprecated pytest hook (#1891) + +--- + conftest.py | 22 ---------------------- + tox.ini | 1 + + 2 files changed, 1 insertion(+), 22 deletions(-) + +diff --git a/conftest.py b/conftest.py +index 303e87302..f93a957af 100644 +--- a/conftest.py ++++ b/conftest.py +@@ -1,27 +1,5 @@ + """PyTest Fixtures.""" + import os +-import re +-import sys +-from typing import List + + os.environ["NO_COLOR"] = "1" + pytest_plugins = ["ansiblelint.testing.fixtures"] +- +- +-def pytest_cmdline_preparse(args: List[str]) -> None: +- """Pytest hook.""" +- # disable xdist when called with -k args (filtering) +- # https://stackoverflow.com/questions/66407583/how-to-disable-pytest-xdist-only-when-pytest-is-called-with-filters +- if "xdist" in sys.modules and "-k" in args: +- for i, arg in enumerate(args): +- # remove -n # option +- if arg == "-n": +- del args[i] +- del args[i] +- break +- # remove -n# option +- if re.match(r"-n\d+", arg): +- del args[i] +- break +- +- args[:] = ["-n0"] + args +diff --git a/tox.ini b/tox.ini +index 4ffa9d99e..fb0525be6 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -28,6 +28,7 @@ commands = + {envpython} -m pytest \ + --junitxml "{toxworkdir}/junit.{envname}.xml" \ + {posargs:\ ++ -n0 \ + -m "not eco" \ + -p pytest_cov \ + --cov ansiblelint \