diff --git a/cognee/tests/test_path_config.py b/cognee/tests/test_path_config.py deleted file mode 100644 index 55f641479..000000000 --- a/cognee/tests/test_path_config.py +++ /dev/null @@ -1,21 +0,0 @@ -import os -from pathlib import Path -import pytest -from cognee.root_dir import ensure_absolute_path - - -def test_root_dir_absolute_paths(): - """Test absolute path handling in root_dir.py""" - # Test with absolute path - abs_path = "C:/absolute/path" if os.name == "nt" else "/absolute/path" - result = ensure_absolute_path(abs_path, allow_relative=False) - assert result == str(Path(abs_path).resolve()) - - # Test with relative path (should fail) - rel_path = "relative/path" - with pytest.raises(ValueError, match="must be absolute"): - ensure_absolute_path(rel_path, allow_relative=False) - - # Test with None path - with pytest.raises(ValueError, match="cannot be None"): - ensure_absolute_path(None) diff --git a/cognee/tests/unit/processing/utils/utils_test.py b/cognee/tests/unit/processing/utils/utils_test.py index a684df8ed..ca9f8f065 100644 --- a/cognee/tests/unit/processing/utils/utils_test.py +++ b/cognee/tests/unit/processing/utils/utils_test.py @@ -4,8 +4,9 @@ import pytest from unittest.mock import patch, mock_open from io import BytesIO from uuid import uuid4 +from pathlib import Path - +from cognee.root_dir import ensure_absolute_path from cognee.infrastructure.files.utils.get_file_content_hash import get_file_content_hash from cognee.shared.utils import get_anonymous_id @@ -52,3 +53,21 @@ async def test_get_file_content_hash_stream(): expected_hash = hashlib.md5(b"test_data").hexdigest() result = await get_file_content_hash(stream) assert result == expected_hash + + +@pytest.mark.asyncio +async def test_root_dir_absolute_paths(): + """Test absolute path handling in root_dir.py""" + # Test with absolute path + abs_path = "C:/absolute/path" if os.name == "nt" else "/absolute/path" + result = ensure_absolute_path(abs_path) + assert result == str(Path(abs_path).resolve()) + + # Test with relative path (should fail) + rel_path = "relative/path" + with pytest.raises(ValueError, match="must be absolute"): + ensure_absolute_path(rel_path) + + # Test with None path + with pytest.raises(ValueError, match="cannot be None"): + ensure_absolute_path(None)