From 6ad990791c1d185b517cbe143cf0f5f3a43da751 Mon Sep 17 00:00:00 2001 From: Patrick Ogenstad Date: Wed, 19 Nov 2025 16:24:39 +0100 Subject: [PATCH] Linting: Probable insecure usage of temporary file or directory --- pyproject.toml | 1 - tests/unit/sdk/checks/test_checks.py | 8 +++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b09f1417..074a1618 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -202,7 +202,6 @@ ignore = [ "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. - "S108", # Probable insecure usage of temporary file or directory "S311", # Standard pseudo-random generators are not suitable for cryptographic purposes "S701", # By default, jinja2 sets `autoescape` to `False`. Consider using `autoescape=True` "SIM102", # Use a single `if` statement instead of nested `if` statements diff --git a/tests/unit/sdk/checks/test_checks.py b/tests/unit/sdk/checks/test_checks.py index 8b4cd82a..7fe0c691 100644 --- a/tests/unit/sdk/checks/test_checks.py +++ b/tests/unit/sdk/checks/test_checks.py @@ -1,3 +1,5 @@ +from pathlib import Path + import pytest from infrahub_sdk import InfrahubClient @@ -6,7 +8,7 @@ pytestmark = pytest.mark.httpx_mock(can_send_already_matched_responses=True) -async def test_class_init() -> None: +async def test_class_init(tmp_path: Path) -> None: class IFCheckNoQuery(InfrahubCheck): pass @@ -29,9 +31,9 @@ class IFCheckNoName(InfrahubCheck): check = IFCheckNoName() assert check.name == "IFCheckNoName" - check = IFCheckWithName(root_directory="/tmp") + check = IFCheckWithName(root_directory=str(tmp_path)) assert check.name == "my_check" - assert check.root_directory == "/tmp" + assert check.root_directory == str(tmp_path) async def test_async_init(client) -> None: