Skip to content

Commit

Permalink
More fixes: part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
shatakshiiii committed Jun 14, 2024
1 parent 88d8793 commit 404f8a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
8 changes: 2 additions & 6 deletions src/ansible_navigator/actions/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,17 +443,13 @@ def _run_runner(self) -> None:
if self._args.execution_environment:
self._logger.debug("running collections command with execution environment enabled")
python_exec_path = "/usr/bin/python3"
utils_lib = os.path.join(
os.path.dirname(__file__),
"..",
"utils",
)
utils_lib = Path(__file__).parent / ".." / "utils"

container_volume_mounts = [
# cache directory which has introspection script
f"{cache_path}:{cache_path}",
# KVS library used by both Navigator and the introspection script
f"{utils_lib}:/opt/ansible_navigator_utils",
f"{utils_lib!s}:/opt/ansible_navigator_utils",
]
if Path(self._adjacent_collection_dir).exists():
container_volume_mounts.append(
Expand Down
6 changes: 2 additions & 4 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from __future__ import annotations

import os

from copy import deepcopy
from pathlib import Path
from typing import TYPE_CHECKING
Expand Down Expand Up @@ -39,12 +37,12 @@ def action_run_stdout() -> Generator[type[ActionRunTest], None, None]:


@pytest.fixture(scope="session")
def test_fixtures_dir() -> str:
def test_fixtures_dir() -> Path:
"""Return the test fixture directory.
:return: The test fixture directory.
"""
return os.path.join(os.path.dirname(__file__), "..", "fixtures")
return Path(__file__).parent / ".." / "fixtures"


@pytest.fixture(scope="session")
Expand Down
11 changes: 6 additions & 5 deletions tests/unit/utils/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from __future__ import annotations

import os
import re

from pathlib import Path
Expand Down Expand Up @@ -32,10 +31,11 @@ def test_find_many_settings_home(monkeypatch: pytest.MonkeyPatch) -> None:
:param monkeypatch: The monkeypatch fixture
"""
paths = [os.path.join(Path.home(), ".ansible-navigator" + ext) for ext in EXTENSIONS]
home_path = Path.home() / ".ansible-navigator"
paths = [Path(f"{home_path}{ext}") for ext in EXTENSIONS]

def check_path_exists(arg: Any) -> bool:
return str(arg) in paths
return arg in paths

monkeypatch.setattr(Path, "exists", check_path_exists)
_messages, exit_messages, _found = find_settings_file()
Expand All @@ -48,10 +48,11 @@ def test_find_many_settings_cwd(monkeypatch: pytest.MonkeyPatch) -> None:
:param monkeypatch: The monkeypatch fixture
"""
paths = [os.path.join(os.getcwd(), "ansible-navigator" + ext) for ext in EXTENSIONS]
cwd_path = Path.cwd() / "ansible-navigator"
paths = [Path(f"{cwd_path}{ext}") for ext in EXTENSIONS]

def check_path_exists(arg: Any) -> bool:
return str(arg) in paths
return arg in paths

monkeypatch.setattr(Path, "exists", check_path_exists)
_messages, exit_messages, _found = find_settings_file()
Expand Down

0 comments on commit 404f8a0

Please sign in to comment.