From 23bf5bd038dfd9f6e4c1d45b392e5d034a7d5da0 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 6 Apr 2026 23:43:23 -0700 Subject: [PATCH] test: allow tmp paths in RAG data-type tests via CREWAI_TOOLS_ALLOW_UNSAFE_PATHS TemporaryDirectory creates files under /tmp/ which is outside CWD and is correctly blocked by the new path validation. These tests exercise data-type handling, not security, so add an autouse fixture that sets CREWAI_TOOLS_ALLOW_UNSAFE_PATHS=true for the whole file. Path/URL security is covered by test_rag_tool_path_validation.py. Co-Authored-By: Claude Sonnet 4.6 --- .../tests/tools/rag/test_rag_tool_add_data_type.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/crewai-tools/tests/tools/rag/test_rag_tool_add_data_type.py b/lib/crewai-tools/tests/tools/rag/test_rag_tool_add_data_type.py index 853e6ab00..d8304ee0f 100644 --- a/lib/crewai-tools/tests/tools/rag/test_rag_tool_add_data_type.py +++ b/lib/crewai-tools/tests/tools/rag/test_rag_tool_add_data_type.py @@ -10,6 +10,15 @@ from crewai_tools.rag.data_types import DataType from crewai_tools.tools.rag.rag_tool import RagTool +@pytest.fixture(autouse=True) +def allow_tmp_paths(monkeypatch: pytest.MonkeyPatch) -> None: + """Allow absolute paths outside CWD (e.g. /tmp/) for these data-type tests. + + Path validation is tested separately in test_rag_tool_path_validation.py. + """ + monkeypatch.setenv("CREWAI_TOOLS_ALLOW_UNSAFE_PATHS", "true") + + @pytest.fixture def mock_rag_client() -> MagicMock: """Create a mock RAG client for testing."""