diff --git a/conftest.py b/conftest.py index 2f22153..975f9aa 100644 --- a/conftest.py +++ b/conftest.py @@ -6,6 +6,8 @@ import pytest +from pathlib import Path + from molecule import config, logger, util from molecule.scenario import ephemeral_directory from molecule.app import get_app diff --git a/src/molecule_plugins/podman/driver.py b/src/molecule_plugins/podman/driver.py index dae95bc..44aff7f 100644 --- a/src/molecule_plugins/podman/driver.py +++ b/src/molecule_plugins/podman/driver.py @@ -23,6 +23,7 @@ import os import warnings from shutil import which +from pathlib import Path from ansible_compat.runtime import Runtime from packaging.version import Version diff --git a/test/azure/functional/test_azure.py b/test/azure/functional/test_azure.py index 5c4cc25..6af47ea 100644 --- a/test/azure/functional/test_azure.py +++ b/test/azure/functional/test_azure.py @@ -23,6 +23,8 @@ import pytest +from pathlib import Path + from conftest import change_dir_to from molecule import logger from molecule.app import get_app diff --git a/test/containers/functional/test_containers.py b/test/containers/functional/test_containers.py index d230bf5..bdbdb1f 100644 --- a/test/containers/functional/test_containers.py +++ b/test/containers/functional/test_containers.py @@ -21,6 +21,8 @@ """Functional Tests.""" import os +from pathlib import Path + from conftest import change_dir_to, molecule_directory from molecule import logger from molecule.app import get_app diff --git a/test/docker/test_func.py b/test/docker/test_func.py index 171163c..44435e6 100644 --- a/test/docker/test_func.py +++ b/test/docker/test_func.py @@ -40,21 +40,21 @@ def test_command_init_and_test_scenario(tmp_path: pathlib.Path, DRIVER: str) -> "--driver-name", DRIVER, ] - result = get_app(Path()).run_command(cmd) + result = get_app(tmp_path).run_command(cmd) assert result.returncode == 0 assert scenario_directory.exists() # run molecule reset as this may clean some leftovers from other # test runs and also ensure that reset works. - result = get_app(Path()).run_command(["molecule", "reset"]) # default scenario + result = get_app(tmp_path).run_command(["molecule", "reset"]) # default scenario assert result.returncode == 0 - result = get_app(Path()).run_command(["molecule", "reset", "-s", scenario_name]) + result = get_app(tmp_path).run_command(["molecule", "reset", "-s", scenario_name]) assert result.returncode == 0 cmd = ["molecule", "--debug", "test", "-s", scenario_name] - result = get_app(Path()).run_command(cmd) + result = get_app(tmp_path).run_command(cmd) assert result.returncode == 0 @@ -63,7 +63,7 @@ def test_command_static_scenario() -> None: """Validate that the scenario we included with code still works.""" cmd = ["molecule", "test"] - result = get_app(Path()).run_command(cmd) + result = get_app(tmp_path).run_command(cmd) assert result.returncode == 0 @@ -72,7 +72,7 @@ def test_dockerfile_with_context() -> None: """Verify that Dockerfile.j2 with context works.""" with change_dir_to("test/docker/scenarios/with-context"): cmd = ["molecule", "--debug", "test"] - result = get_app(Path()).run_command(cmd) + result = get_app(tmp_path).run_command(cmd) assert result.returncode == 0 @@ -82,5 +82,5 @@ def test_env_substitution() -> None: os.environ["MOLECULE_ROLE_IMAGE"] = "debian:bullseye" with change_dir_to("test/docker/scenarios/env-substitution"): cmd = ["molecule", "--debug", "test"] - result = get_app(Path()).run_command(cmd) + result = get_app(tmp_path).run_command(cmd) assert result.returncode == 0 diff --git a/test/ec2/functional/test_ec2.py b/test/ec2/functional/test_ec2.py index fd65679..fbeab94 100644 --- a/test/ec2/functional/test_ec2.py +++ b/test/ec2/functional/test_ec2.py @@ -23,6 +23,8 @@ import pytest +from pathlib import Path + from conftest import change_dir_to, metadata_lint_update from molecule import logger from molecule.app import get_app diff --git a/test/gce/functional/test_func.py b/test/gce/functional/test_func.py index b0ebe5f..f38f386 100644 --- a/test/gce/functional/test_func.py +++ b/test/gce/functional/test_func.py @@ -23,6 +23,8 @@ import pytest +from pathlib import Path + from conftest import change_dir_to, metadata_lint_update from molecule import logger from molecule.app import get_app diff --git a/test/openstack/test_func.py b/test/openstack/test_func.py index 340b03b..0f4edf1 100644 --- a/test/openstack/test_func.py +++ b/test/openstack/test_func.py @@ -5,6 +5,8 @@ import shutil import subprocess +from pathlib import Path + import pytest import openstack @@ -53,7 +55,7 @@ def test_openstack_init_and_test_scenario(tmp_path: pathlib.Path, DRIVER: str) - "--driver-name", DRIVER, ] - result = get_app(Path()).run_command(cmd) + result = get_app(tmp_path).run_command(cmd) assert result.returncode == 0 assert scenario_directory.exists() @@ -71,7 +73,7 @@ def test_openstack_init_and_test_scenario(tmp_path: pathlib.Path, DRIVER: str) - shutil.copyfile(testconf, confpath) cmd = ["molecule", "--debug", "test", "-s", scenario_name] - result = get_app(Path()).run_command(cmd) + result = get_app(tmp_path).run_command(cmd) assert result.returncode == 0 diff --git a/test/podman/test_func.py b/test/podman/test_func.py index 47f1889..a78a8be 100644 --- a/test/podman/test_func.py +++ b/test/podman/test_func.py @@ -4,6 +4,8 @@ import pathlib import subprocess +from pathlib import Path + from conftest import change_dir_to from molecule import logger from molecule.app import get_app @@ -35,21 +37,21 @@ def test_podman_command_init_scenario(tmp_path: pathlib.Path): "--driver-name", "podman", ] - result = get_app(Path()).run_command(cmd) + result = get_app(tmp_path).run_command(cmd) assert result.returncode == 0 assert scenario_directory.exists() # run molecule reset as this may clean some leftovers from other # test runs and also ensure that reset works. - result = get_app(Path()).run_command(["molecule", "reset"]) # default sceanario + result = get_app(tmp_path).run_command(["molecule", "reset"]) # default sceanario assert result.returncode == 0 - result = get_app(Path()).run_command(["molecule", "reset", "-s", scenario_name]) + result = get_app(tmp_path).run_command(["molecule", "reset", "-s", scenario_name]) assert result.returncode == 0 cmd = ["molecule", "--debug", "test", "-s", scenario_name] - result = get_app(Path()).run_command(cmd) + result = get_app(tmp_path).run_command(cmd) assert result.returncode == 0 diff --git a/test/vagrant-plugin/functional/test_func.py b/test/vagrant-plugin/functional/test_func.py index a3c9c88..97a6a5a 100644 --- a/test/vagrant-plugin/functional/test_func.py +++ b/test/vagrant-plugin/functional/test_func.py @@ -26,6 +26,8 @@ import pytest import vagrant +from pathlib import Path + from conftest import change_dir_to from molecule import logger, util from molecule.scenario import ephemeral_directory