Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions infrahub_sdk/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import importlib
import inspect
import os
import pathlib
import warnings
from abc import abstractmethod
from typing import TYPE_CHECKING, Any
Expand Down Expand Up @@ -55,7 +55,7 @@ def __init__(
self.branch = branch
self.params = params or {}

self.root_directory = root_directory or os.getcwd()
self.root_directory = root_directory or str(pathlib.Path.cwd())

self._client = client

Expand Down
4 changes: 2 additions & 2 deletions infrahub_sdk/operation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

import os
import pathlib
from typing import TYPE_CHECKING

from .repository import GitRepoManager
Expand All @@ -22,7 +22,7 @@ def __init__(
) -> None:
self.branch = branch
self.convert_query_response = convert_query_response
self.root_directory = root_directory or os.getcwd()
self.root_directory = root_directory or str(pathlib.Path.cwd())
self.infrahub_node = infrahub_node
self._nodes: list[InfrahubNode] = []
self._related_nodes: list[InfrahubNode] = []
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ ignore = [
"PLR6301", # Method could be a function, class method, or static method
"PLW0603", # Using the global statement to update `SETTINGS` is discouraged
"PLW1641", # Object does not implement `__hash__` method
"PTH100", # `os.path.abspath()` should be replaced by `Path.resolve()`
"PTH109", # `os.getcwd()` should be replaced by `Path.cwd()`
"RUF005", # Consider `[*path, str(key)]` instead of concatenation
"RUF029", # Function is declared `async`, but doesn't `await` or use `async` features.
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
Expand Down
4 changes: 2 additions & 2 deletions tests/helpers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
def change_directory(new_directory: str) -> Generator[None, None, None]:
"""Helper function used to change directories in a with block."""
# Save the current working directory
original_directory = os.getcwd()
original_directory = Path.cwd()

# Change to the new directory
try:
Expand All @@ -30,7 +30,7 @@ def change_directory(new_directory: str) -> Generator[None, None, None]:
@contextmanager
def temp_repo_and_cd(source_dir: Path) -> Generator[Path, None, None]:
temp_dir = tempfile.mkdtemp()
original_directory = os.getcwd()
original_directory = Path.cwd()

try:
shutil.copytree(source_dir, temp_dir, dirs_exist_ok=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_infrahubctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
if TYPE_CHECKING:
from infrahub_sdk import InfrahubClient

FIXTURE_BASE_DIR = Path(Path(os.path.abspath(__file__)).parent / ".." / "fixtures")
FIXTURE_BASE_DIR = Path(Path(Path(__file__).resolve()).parent / ".." / "fixtures")


runner = CliRunner()
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/ctl/test_render_app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import os
from dataclasses import dataclass
from pathlib import Path

Expand All @@ -14,7 +13,7 @@
runner = CliRunner()


FIXTURE_BASE_DIR = Path(Path(os.path.abspath(__file__)).parent / ".." / ".." / "fixtures" / "repos")
FIXTURE_BASE_DIR = Path(Path(Path(__file__).resolve()).parent / ".." / ".." / "fixtures" / "repos")


@dataclass
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/ctl/test_transform_app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Integration tests for infrahubctl commands."""

import json
import os
import shutil
import tempfile
from collections.abc import Generator
Expand All @@ -20,7 +19,7 @@


FIXTURE_BASE_DIR = Path(
Path(os.path.abspath(__file__)).parent / ".." / ".." / "fixtures" / "integration" / "test_infrahubctl"
Path(Path(__file__).resolve()).parent / ".." / ".." / "fixtures" / "integration" / "test_infrahubctl"
)


Expand Down