From ef304a8bf7a991512f58e29d19482c0530832596 Mon Sep 17 00:00:00 2001 From: "Bradley A. Thornton" Date: Wed, 5 Jun 2024 07:43:00 -0700 Subject: [PATCH] Respect ANSIBLE_COLLECTIONS_PATH (#4192) Inform ansible compat that the ANSIBLE_COLLECTIONS_PATH does not need to be set. The change in compat behaviour changed here: https://github.com/ansible/ansible-compat/commit/32ce03c9989698544353a24a5f8b7399c1a0b8a0#diff-52de7db791930eca228ba958a8fe0d53d2695de26a1d6e1aa1906da28f607892R395 and was released in 24.6.0 Other changes as needed based on pre-commit version updates that came with the deps update --- .config/constraints.txt | 2 +- .config/requirements.in | 2 +- .pre-commit-config.yaml | 10 +++++----- src/molecule/util.py | 1 + test/a_unit/conftest.py | 12 ++++++------ test/a_unit/driver/test_delegated.py | 2 +- test/a_unit/provisioner/test_ansible.py | 2 +- test/a_unit/provisioner/test_ansible_playbooks.py | 2 +- test/a_unit/test_util.py | 5 ++++- test/b_functional/conftest.py | 2 +- test/b_functional/test_command.py | 14 +++++++------- 11 files changed, 29 insertions(+), 25 deletions(-) diff --git a/.config/constraints.txt b/.config/constraints.txt index 66484c27d..02c4b9fc5 100644 --- a/.config/constraints.txt +++ b/.config/constraints.txt @@ -5,7 +5,7 @@ # pip-compile --all-extras --no-annotate --output-file=.config/constraints.txt --strip-extras --unsafe-package=resolvelib --unsafe-package=ruamel-yaml-clib --unsafe-package=wcmatch pyproject.toml # ansi2html==1.9.1 -ansible-compat==24.5.1 +ansible-compat==24.6.1 ansible-core==2.17.0 ansible-lint==24.5.0 attrs==23.2.0 diff --git a/.config/requirements.in b/.config/requirements.in index a3c5fb056..86d726ffc 100644 --- a/.config/requirements.in +++ b/.config/requirements.in @@ -1,4 +1,4 @@ -ansible-compat >= 4.1.8 +ansible-compat >= 24.6.1 ansible-core >= 2.12.10 click >= 8.0, < 9 click-help-colors >= 0.9 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 98af8fa5a..449fe7e03 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ repos: - prettier - prettier-plugin-toml - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 + rev: v2.3.0 hooks: - id: codespell - repo: https://github.com/psf/black @@ -49,7 +49,7 @@ repos: types: [file, yaml] entry: yamllint --strict - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.4.4" + rev: "v0.4.7" hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] @@ -62,7 +62,7 @@ repos: entry: mypy src/ test/ pass_filenames: false additional_dependencies: - - ansible-compat>=4.1.8 + - ansible-compat>=24.6.1 - click>=8.0.1,<8.1.4 # https://github.com/pallets/click/issues/2558 - enrich>=1.2.7 - importlib-metadata>=4.6.1 @@ -85,7 +85,7 @@ repos: args: - --output-format=colorized additional_dependencies: - - ansible-compat>=4.1.8 + - ansible-compat>=24.6.1 - click - click-help-colors - enrich>=1.2.7 @@ -96,7 +96,7 @@ repos: - pytest-testinfra - wcmatch - repo: https://github.com/ansible/ansible-lint - rev: v24.5.0 + rev: v24.6.0 hooks: - id: ansible-lint - repo: https://github.com/jazzband/pip-tools diff --git a/src/molecule/util.py b/src/molecule/util.py index 5e8f1bdef..076a13f13 100644 --- a/src/molecule/util.py +++ b/src/molecule/util.py @@ -141,6 +141,7 @@ def run_command( env=env, cwd=cwd, tee=True, + set_acp=False, ) if result.returncode != 0 and check: raise CalledProcessError( diff --git a/test/a_unit/conftest.py b/test/a_unit/conftest.py index 75bbab233..69d56a368 100644 --- a/test/a_unit/conftest.py +++ b/test/a_unit/conftest.py @@ -24,12 +24,6 @@ from collections.abc import Generator from pathlib import Path from subprocess import CompletedProcess -from test.conftest import ( - molecule_directory, - molecule_ephemeral_directory, - molecule_file, - molecule_scenario_directory, -) from typing import Any from unittest.mock import Mock from uuid import uuid4 @@ -38,6 +32,12 @@ from pytest_mock import MockerFixture from molecule import config, util +from test.conftest import ( # pylint:disable=C0411 + molecule_directory, + molecule_ephemeral_directory, + molecule_file, + molecule_scenario_directory, +) def write_molecule_file(filename: str, data: Any) -> None: diff --git a/test/a_unit/driver/test_delegated.py b/test/a_unit/driver/test_delegated.py index 6516a3b25..6ca5ae55b 100644 --- a/test/a_unit/driver/test_delegated.py +++ b/test/a_unit/driver/test_delegated.py @@ -19,13 +19,13 @@ # DEALINGS IN THE SOFTWARE. import os -from test.conftest import is_subset import pytest from pytest_mock import MockerFixture from molecule import config from molecule.driver import delegated +from test.conftest import is_subset # pylint:disable=C0411 @pytest.fixture() diff --git a/test/a_unit/provisioner/test_ansible.py b/test/a_unit/provisioner/test_ansible.py index 54ce8f4bf..a6e2e1b6c 100644 --- a/test/a_unit/provisioner/test_ansible.py +++ b/test/a_unit/provisioner/test_ansible.py @@ -21,13 +21,13 @@ import collections import os import re -from test.a_unit.conftest import os_split import pytest from pytest_mock import MockerFixture from molecule import config, util from molecule.provisioner import ansible, ansible_playbooks +from test.a_unit.conftest import os_split # pylint:disable=C0411 @pytest.fixture() diff --git a/test/a_unit/provisioner/test_ansible_playbooks.py b/test/a_unit/provisioner/test_ansible_playbooks.py index 662df64b0..8119d68e5 100644 --- a/test/a_unit/provisioner/test_ansible_playbooks.py +++ b/test/a_unit/provisioner/test_ansible_playbooks.py @@ -19,12 +19,12 @@ # DEALINGS IN THE SOFTWARE. import os -from test.a_unit.conftest import os_split import pytest from molecule import config, util from molecule.provisioner import ansible_playbooks +from test.a_unit.conftest import os_split # pylint:disable=C0411 @pytest.fixture() diff --git a/test/a_unit/test_util.py b/test/a_unit/test_util.py index c1f16edb3..bc020cfa9 100644 --- a/test/a_unit/test_util.py +++ b/test/a_unit/test_util.py @@ -23,7 +23,6 @@ import os import warnings from pathlib import Path -from test.conftest import get_molecule_file, molecule_directory from typing import Any import pytest @@ -34,6 +33,10 @@ from molecule.console import console from molecule.constants import MOLECULE_HEADER from molecule.text import strip_ansi_escape +from test.conftest import ( # pylint:disable = C0411 + get_molecule_file, + molecule_directory, +) def test_print_debug(): diff --git a/test/b_functional/conftest.py b/test/b_functional/conftest.py index cdabab45f..e40bcddb5 100644 --- a/test/b_functional/conftest.py +++ b/test/b_functional/conftest.py @@ -24,7 +24,6 @@ import shutil import subprocess from subprocess import PIPE -from test.conftest import change_dir_to, molecule_directory import pexpect import pytest @@ -36,6 +35,7 @@ from molecule.app import app from molecule.text import strip_ansi_color from molecule.util import run_command +from test.conftest import change_dir_to, molecule_directory # pylint:disable=C0411 LOG = logger.get_logger(__name__) diff --git a/test/b_functional/test_command.py b/test/b_functional/test_command.py index 745f37506..536ba7515 100644 --- a/test/b_functional/test_command.py +++ b/test/b_functional/test_command.py @@ -21,19 +21,19 @@ import os import pathlib -from test.b_functional.conftest import ( - idempotence, - init_scenario, - list_with_format_plain, - run_test, - verify, -) import pytest from pytest import FixtureRequest from molecule.command import base from molecule.util import run_command +from test.b_functional.conftest import ( # pylint:disable=C0411 + idempotence, + init_scenario, + list_with_format_plain, + run_test, + verify, +) @pytest.fixture()