Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.
Chore/claude tests (#137)
Louis Choquel9835dba6fe6a
diff --git a/.gitignore b/.gitignoreindex 8d5bc3845..fb58afe0d 100644--- a/.gitignore+++ b/.gitignore@@ -54,4 +54,5 @@ temp/gcp_credentials.json-/pipelex.toml\ No newline at end of file+/pipelex.toml+settings.local.jsondiff --git a/CLAUDE.md b/CLAUDE.mdnew file mode 100644index 000000000..1e1309494--- /dev/null+++ b/CLAUDE.md@@ -0,0 +1,91 @@+# General rules++## Repo structure++Pipelex is a framework to run low-code AI workflows for repeatable processes.+This python >=3.10 code is in the `pipelex` directory.++## Code Style & formatting++- Imitate existing style+- Use type hints+- Respect Pydantic v2 standard+- Use Typer for CLIs+- Use explicit keyword arguments for function calls with multiple parameters (e.g., `func(arg_name=value)` not just `func(value)`)+- Add trailing commas to multi-line lists, dicts, function arguments, and tuples with >2 items (helps with cleaner diffs and prevents syntax errors when adding items)+- All imports inside this repo's packages must be absolute package paths from the root++## Test file structure++- Name test files with `test_` prefix+- Use descriptive names that match the functionality being tested+- Place test files in the appropriate test category directory:+ - `tests/unit/` - for unit tests that test individual functions/classes in isolation+ - `tests/integration/` - for integration tests that test component interactions+ - `tests/e2e/` - for end-to-end tests that test complete workflows+ - `tests/test_pipelines/` - for test pipeline definitions (TOML files and their structuring python files)+- Fixtures are defined in conftest.py modules at different levels of the hierarchy, their scope is handled by pytest+- Test data is placed inside test_data.py at different levels of the hierarchy, they must be imported with package paths from the root like `tests.pipelex.test_data`. Their content is all constants, regrouped inside classes to keep things tidy.+- Always put test inside Test classes.+- The pipelex pipelines should be stored in `tests/test_pipelines` as well as the related structured Output classes that inherit from `StructuredContent`++## Markers++Apply the appropriate markers:+- "llm: uses an LLM to generate text or objects"+- "imgg: uses an image generation AI"+- "inference: uses either an LLM or an image generation AI"+- "gha_disabled: will not be able to run properly on GitHub Actions"++Several markers may be applied. For instance, if the test uses an LLM, then it uses inference, so you must mark with both `inference`and `llm`.++## Test Class Structure++Always group the tests of a module into a test class:++```python[email protected](loop_scope="class")+class TestFooBar:+ @pytest.mark.parametrize(+ "topic test_case_blueprint",+ [+ TestCases.CASE_1,+ TestCases.CASE_2,+ ],+ )+ async def test_pipe_processing(+ self,+ request: FixtureRequest,+ topic: str,+ test_case_blueprint: StuffBlueprint,+ ):+ # Test implementation+```++## Linting & checking++- Run `make lint` -> it runs `ruff check . --fix` to enforce all our linting rules+- Run `make pyright` -> it typechecks with pyright using proper settings+- Run `make mypy` -> it typechecks with mypy using proper settings+ - if you added a dependency and mypy complains that it's not typed, add it to the list of modules in [[tool.mypy.overrides]] in pyproject.toml, be sure to signal it in your PR recap so that maintainers can look for existing stubs+- After `make pyright`, you must also check with `make mypy`++## Testing++- Always test with `make t` -> it runs pytest using proper settings+- If some pytest tests fail, run pytest on the failed ones with the required verbosity to diagnose the issue+- If all unit tests pass, run `make validate` -> it runs a minimal version of our app with just the inits and data loading++## PR Instructions++- Run `make fix-unused-imports` -> removes unused imports, required to validate PR+- Re-run checks in one call with `make check` -> formatting and linting with Ruff, type-checking with Pyright and Mypy+- Re-run `make codex-tests`+- Write a one-line summary of the changes.+- Be sure to list changes made to configs, tests and dependencies++## More docs++- Scan the *.mdc files in .cursor/rules/ to get usefull details and explanations on the codebase\ No newline at end of filediff --git a/tests/unit/pipelex/tools/misc/test_filetype_utils.py b/tests/unit/pipelex/tools/misc/test_filetype_utils.pynew file mode 100644index 000000000..8ef4afadb--- /dev/null+++ b/tests/unit/pipelex/tools/misc/test_filetype_utils.py@@ -0,0 +1,242 @@+import base64+import binascii+from pathlib import Path++import pytest+from pytest_mock import MockerFixture++from pipelex.tools.misc.filetype_utils import (+ FileType,+ FileTypeException,+ detect_file_type_from_base64,+ detect_file_type_from_bytes,+ detect_file_type_from_path,+)+++class TestFileType:+ def test_file_type_creation(self):+ file_type = FileType(extension="jpg", mime="image/jpeg")+ assert file_type.extension == "jpg"+ assert file_type.mime == "image/jpeg"++ def test_file_type_pydantic_validation(self):+ # Test that FileType is a proper Pydantic model+ data = {"extension": "png", "mime": "image/png"}+ file_type = FileType(**data)+ assert file_type.extension == "png"+ assert file_type.mime == "image/png"+++class TestFileTypeException:+ def test_file_type_exception_inheritance(self):+ error = FileTypeException("test message")+ assert isinstance(error, Exception)+ assert str(error) == "test message"+++class TestDetectFileTypeFromPath:+ def test_detect_file_type_from_path_success_string(self, mocker: MockerFixture):+ # Mock the filetype.guess function+ mock_kind = mocker.MagicMock()+ mock_kind.extension = "jpg"+ mock_kind.mime = "image/jpeg"+ mock_filetype_guess = mocker.patch("filetype.guess", return_value=mock_kind)++ result = detect_file_type_from_path("/path/to/image.jpg")++ assert isinstance(result, FileType)+ assert result.extension == "jpg"+ assert result.mime == "image/jpeg"+ mock_filetype_guess.assert_called_once_with("/path/to/image.jpg")++ def test_detect_file_type_from_path_success_pathlib(self, mocker: MockerFixture):+ # Mock the filetype.guess function+ mock_kind = mocker.MagicMock()+ mock_kind.extension = "png"+ mock_kind.mime = "image/png"+ mock_filetype_guess = mocker.patch("filetype.guess", return_value=mock_kind)++ path = Path("/path/to/image.png")+ result = detect_file_type_from_path(path)++ assert isinstance(result, FileType)+ assert result.extension == "png"+ assert result.mime == "image/png"+ mock_filetype_guess.assert_called_once_with(path)++ def test_detect_file_type_from_path_failure(self, mocker: MockerFixture):+ # Mock filetype.guess to return None (unrecognized file type)+ mock_filetype_guess = mocker.patch("filetype.guess", return_value=None)++ with pytest.raises(FileTypeException, match="Could not identify file type of '/unknown/file.xyz'"):+ detect_file_type_from_path("/unknown/file.xyz")++ mock_filetype_guess.assert_called_once_with("/unknown/file.xyz")++ def test_detect_file_type_from_path_failure_pathlib(self, mocker: MockerFixture):+ # Mock filetype.guess to return None (unrecognized file type)+ mock_filetype_guess = mocker.patch("filetype.guess", return_value=None)++ path = Path("/unknown/file.xyz")+ with pytest.raises(FileTypeException, match="Could not identify file type of '/unknown/file.xyz'"):+ detect_file_type_from_path(path)++ mock_filetype_guess.assert_called_once_with(path)+++class TestDetectFileTypeFromBytes:+ def test_detect_file_type_from_bytes_success(self, mocker: MockerFixture):+ # Mock the filetype.guess function+ mock_kind = mocker.MagicMock()+ mock_kind.extension = "pdf"+ mock_kind.mime = "application/pdf"+ mock_filetype_guess = mocker.patch("filetype.guess", return_value=mock_kind)++ test_bytes = b"\x25\x50\x44\x46" # PDF header+ result = detect_file_type_from_bytes(test_bytes)++ assert isinstance(result, FileType)+ assert result.extension == "pdf"+ assert result.mime == "application/pdf"+ mock_filetype_guess.assert_called_once_with(test_bytes)++ def test_detect_file_type_from_bytes_failure(self, mocker: MockerFixture):+ # Mock filetype.guess to return None (unrecognized file type)+ mock_filetype_guess = mocker.patch("filetype.guess", return_value=None)++ test_bytes = b"unknown file content"+ with pytest.raises(FileTypeException, match="Could not identify file type of given bytes: b'unknown file content'"):+ detect_file_type_from_bytes(test_bytes)++ mock_filetype_guess.assert_called_once_with(test_bytes)++ def test_detect_file_type_from_bytes_failure_long_bytes(self, mocker: MockerFixture):+ # Mock filetype.guess to return None and test truncation of long bytes in error message+ mock_filetype_guess = mocker.patch("filetype.guess", return_value=None)++ # Create bytes longer than 300 characters to test truncation+ test_bytes = b"a" * 350+ with pytest.raises(FileTypeException) as exc_info:+ detect_file_type_from_bytes(test_bytes)++ # Check that the error message contains truncated bytes (first 300 chars)+ error_message = str(exc_info.value)+ assert "Could not identify file type of given bytes:" in error_message+ assert len(error_message) < len(f"Could not identify file type of given bytes: {test_bytes!r}")+ mock_filetype_guess.assert_called_once_with(test_bytes)+++class TestDetectFileTypeFromBase64:+ def test_detect_file_type_from_base64_string_success(self, mocker: MockerFixture):+ # Mock detect_file_type_from_bytes+ mock_detect_bytes = mocker.patch(+ "pipelex.tools.misc.filetype_utils.detect_file_type_from_bytes", return_value=FileType(extension="gif", mime="image/gif")+ )++ # GIF header encoded in base64+ gif_bytes = b"GIF89a"+ b64_string = base64.b64encode(gif_bytes).decode("ascii")++ result = detect_file_type_from_base64(b64_string)++ assert isinstance(result, FileType)+ assert result.extension == "gif"+ assert result.mime == "image/gif"+ mock_detect_bytes.assert_called_once_with(buf=gif_bytes)++ def test_detect_file_type_from_base64_bytes_success(self, mocker: MockerFixture):+ # Mock detect_file_type_from_bytes+ mock_detect_bytes = mocker.patch(+ "pipelex.tools.misc.filetype_utils.detect_file_type_from_bytes", return_value=FileType(extension="jpg", mime="image/jpeg")+ )++ # JPEG header encoded in base64+ jpeg_bytes = b"\xff\xd8\xff"+ b64_bytes = base64.b64encode(jpeg_bytes)++ result = detect_file_type_from_base64(b64_bytes)++ assert isinstance(result, FileType)+ assert result.extension == "jpg"+ assert result.mime == "image/jpeg"+ mock_detect_bytes.assert_called_once_with(buf=jpeg_bytes)++ def test_detect_file_type_from_base64_data_url_success(self, mocker: MockerFixture):+ # Mock detect_file_type_from_bytes+ mock_detect_bytes = mocker.patch(+ "pipelex.tools.misc.filetype_utils.detect_file_type_from_bytes", return_value=FileType(extension="png", mime="image/png")+ )++ # PNG header encoded in base64+ png_bytes = b"\x89PNG\r\n\x1a\n"+ b64_data = base64.b64encode(png_bytes).decode("ascii")+ data_url = f"data:image/png;base64,{b64_data}"++ result = detect_file_type_from_base64(data_url)++ assert isinstance(result, FileType)+ assert result.extension == "png"+ assert result.mime == "image/png"+ mock_detect_bytes.assert_called_once_with(buf=png_bytes)++ def test_detect_file_type_from_base64_data_url_with_whitespace(self, mocker: MockerFixture):+ # Mock detect_file_type_from_bytes+ mock_detect_bytes = mocker.patch(+ "pipelex.tools.misc.filetype_utils.detect_file_type_from_bytes", return_value=FileType(extension="txt", mime="text/plain")+ )++ test_bytes = b"hello world"+ b64_data = base64.b64encode(test_bytes).decode("ascii")+ # Note: The function strips leading whitespace but not trailing whitespace after comma+ data_url_with_whitespace = f" data:text/plain;base64,{b64_data}"++ result = detect_file_type_from_base64(data_url_with_whitespace)++ assert isinstance(result, FileType)+ assert result.extension == "txt"+ assert result.mime == "text/plain"+ mock_detect_bytes.assert_called_once_with(buf=test_bytes)++ def test_detect_file_type_from_base64_invalid_base64_string(self, mocker: MockerFixture):+ # Test with invalid base64 string+ invalid_b64 = "invalid!base64!string!"++ with pytest.raises(FileTypeException, match="Could not identify file type of given bytes because input is not valid Base-64"):+ detect_file_type_from_base64(invalid_b64)++ def test_detect_file_type_from_base64_invalid_base64_bytes(self, mocker: MockerFixture):+ # Test with invalid base64 bytes+ invalid_b64_bytes = b"invalid!base64!bytes!"++ with pytest.raises(FileTypeException, match="Could not identify file type of given bytes because input is not valid Base-64"):+ detect_file_type_from_base64(invalid_b64_bytes)++ def test_detect_file_type_from_base64_data_url_no_comma(self, mocker: MockerFixture):+ # Test data URL without comma (should be treated as regular base64)+ mocker.patch(+ "pipelex.tools.misc.filetype_utils.detect_file_type_from_bytes", return_value=FileType(extension="bin", mime="application/octet-stream")+ )++ # This will be treated as a base64 string since there's no comma+ no_comma_url = "data:image/png;base64somedata"+ # base64 decode will likely fail, but let's mock it working for testing+ mocker.patch("base64.b64decode", return_value=b"test")++ result = detect_file_type_from_base64(no_comma_url)++ assert isinstance(result, FileType)+ assert result.extension == "bin"+ assert result.mime == "application/octet-stream"++ def test_detect_file_type_from_base64_binascii_error_chain(self, mocker: MockerFixture):+ # Test that binascii.Error is properly chained when base64 decode fails+ mocker.patch("base64.b64decode", side_effect=binascii.Error("Invalid base64"))++ with pytest.raises(FileTypeException) as exc_info:+ detect_file_type_from_base64("invalid")++ # Check that the original exception is chained+ assert exc_info.value.__cause__ is not None+ assert isinstance(exc_info.value.__cause__, binascii.Error)+ assert str(exc_info.value.__cause__) == "Invalid base64"diff --git a/tests/unit/pipelex/tools/misc/test_path_utils.py b/tests/unit/pipelex/tools/misc/test_path_utils.pynew file mode 100644index 000000000..4c280bc91--- /dev/null+++ b/tests/unit/pipelex/tools/misc/test_path_utils.py@@ -0,0 +1,186 @@+import pytest+from pytest_mock import MockerFixture++from pipelex.tools.misc.path_utils import (+ InterpretedPathOrUrl,+ clarify_path_or_url,+ interpret_path_or_url,+)+++class TestInterpretedPathOrUrl:+ def test_enum_values(self):+ assert InterpretedPathOrUrl.FILE_URI == "file_uri"+ assert InterpretedPathOrUrl.FILE_PATH == "file_path"+ assert InterpretedPathOrUrl.URL == "uri"+ assert InterpretedPathOrUrl.FILE_NAME == "file_name"+ assert InterpretedPathOrUrl.BASE_64 == "base_64"++ def test_desc_property_file_uri(self):+ assert InterpretedPathOrUrl.FILE_URI.desc == "File URI"++ def test_desc_property_file_path(self):+ assert InterpretedPathOrUrl.FILE_PATH.desc == "File Path"++ def test_desc_property_url(self):+ assert InterpretedPathOrUrl.URL.desc == "URL"++ def test_desc_property_file_name(self):+ assert InterpretedPathOrUrl.FILE_NAME.desc == "File Name"++ def test_desc_property_base_64(self):+ assert InterpretedPathOrUrl.BASE_64.desc == "Base 64"+++class TestInterpretPathOrUrl:+ def test_interpret_file_uri(self):+ result = interpret_path_or_url("file:///home/user/file.txt")+ assert result == InterpretedPathOrUrl.FILE_URI++ def test_interpret_file_uri_windows(self):+ result = interpret_path_or_url("file:///C:/Users/user/file.txt")+ assert result == InterpretedPathOrUrl.FILE_URI++ def test_interpret_http_url(self):+ result = interpret_path_or_url("http://example.com")+ assert result == InterpretedPathOrUrl.URL++ def test_interpret_https_url(self):+ result = interpret_path_or_url("https://example.com/path")+ assert result == InterpretedPathOrUrl.URL++ def test_interpret_absolute_file_path_unix(self):+ result = interpret_path_or_url("/home/user/file.txt")+ assert result == InterpretedPathOrUrl.FILE_PATH++ def test_interpret_relative_file_path_unix(self):+ result = interpret_path_or_url("user/file.txt")+ assert result == InterpretedPathOrUrl.FILE_PATH++ def test_interpret_absolute_file_path_windows_style(self):+ # Test with actual Windows-style paths (backslashes)+ # On Unix systems, backslashes aren't recognized as path separators+ result = interpret_path_or_url("C:\\Users\\user\\file.txt")+ assert result == InterpretedPathOrUrl.FILE_NAME++ def test_interpret_relative_file_path_windows_style(self):+ # Test with actual Windows-style paths (backslashes)+ # On Unix systems, backslashes aren't recognized as path separators+ result = interpret_path_or_url("user\\file.txt")+ assert result == InterpretedPathOrUrl.FILE_NAME++ def test_interpret_path_with_current_os_separator(self, mocker: MockerFixture):+ # Test with the current OS path separator+ import os++ path_with_sep = f"user{os.sep}file.txt"+ result = interpret_path_or_url(path_with_sep)+ assert result == InterpretedPathOrUrl.FILE_PATH++ def test_interpret_file_name_only(self):+ result = interpret_path_or_url("file.txt")+ assert result == InterpretedPathOrUrl.FILE_NAME++ def test_interpret_file_name_no_extension(self):+ result = interpret_path_or_url("filename")+ assert result == InterpretedPathOrUrl.FILE_NAME++ def test_interpret_empty_string(self):+ result = interpret_path_or_url("")+ assert result == InterpretedPathOrUrl.FILE_NAME++ def test_interpret_edge_case_http_in_path(self):+ result = interpret_path_or_url("/path/to/http_file.txt")+ assert result == InterpretedPathOrUrl.FILE_PATH++ def test_interpret_edge_case_file_in_url(self):+ result = interpret_path_or_url("http://example.com/file.txt")+ assert result == InterpretedPathOrUrl.URL+++class TestClarifyPathOrUrl:+ def test_clarify_file_uri_unix(self):+ file_path, url = clarify_path_or_url("file:///home/user/file.txt")+ assert file_path == "/home/user/file.txt"+ assert url is None++ def test_clarify_file_uri_windows(self):+ file_path, url = clarify_path_or_url("file:///C:/Users/user/file.txt")+ assert file_path == "/C:/Users/user/file.txt"+ assert url is None++ def test_clarify_file_uri_with_spaces(self):+ file_path, url = clarify_path_or_url("file:///home/user/my%20file.txt")+ assert file_path == "/home/user/my file.txt"+ assert url is None++ def test_clarify_file_uri_with_special_chars(self):+ file_path, url = clarify_path_or_url("file:///home/user/file%20%26%20more.txt")+ assert file_path == "/home/user/file & more.txt"+ assert url is None++ def test_clarify_http_url(self):+ file_path, url = clarify_path_or_url("http://example.com")+ assert file_path is None+ assert url == "http://example.com"++ def test_clarify_https_url(self):+ file_path, url = clarify_path_or_url("https://example.com/path/to/file")+ assert file_path is None+ assert url == "https://example.com/path/to/file"++ def test_clarify_absolute_file_path(self):+ file_path, url = clarify_path_or_url("/home/user/file.txt")+ assert file_path == "/home/user/file.txt"+ assert url is None++ def test_clarify_relative_file_path(self):+ file_path, url = clarify_path_or_url("user/file.txt")+ assert file_path == "user/file.txt"+ assert url is None++ def test_clarify_file_name_only(self):+ file_path, url = clarify_path_or_url("file.txt")+ assert file_path == "file.txt"+ assert url is None++ def test_clarify_empty_string(self):+ file_path, url = clarify_path_or_url("")+ assert file_path == ""+ assert url is None++ def test_clarify_base_64_raises_not_implemented(self, mocker: MockerFixture):+ with pytest.raises(NotImplementedError, match="Base 64 is not supported yet by clarify_path_or_url"):+ # Mock interpret_path_or_url to return BASE_64+ mocker.patch(+ "pipelex.tools.misc.path_utils.interpret_path_or_url",+ return_value=InterpretedPathOrUrl.BASE_64,+ )+ clarify_path_or_url("some_base64_data")++ def test_clarify_uses_interpret_path_or_url(self, mocker: MockerFixture):+ mock_interpret = mocker.patch(+ "pipelex.tools.misc.path_utils.interpret_path_or_url",+ return_value=InterpretedPathOrUrl.FILE_PATH,+ )++ clarify_path_or_url("/test/path")++ mock_interpret.assert_called_once_with("/test/path")++ def test_clarify_urlparse_called_for_file_uri(self, mocker: MockerFixture):+ mock_urlparse = mocker.patch("urllib.parse.urlparse")+ mock_urlparse.return_value.path = "/home/user/file.txt"+ mock_unquote = mocker.patch("urllib.parse.unquote", return_value="/home/user/file.txt")++ mocker.patch(+ "pipelex.tools.misc.path_utils.interpret_path_or_url",+ return_value=InterpretedPathOrUrl.FILE_URI,+ )++ file_path, url = clarify_path_or_url("file:///home/user/file.txt")++ mock_urlparse.assert_called_once_with("file:///home/user/file.txt")+ mock_unquote.assert_called_once_with("/home/user/file.txt")+ assert file_path == "/home/user/file.txt"+ assert url is Nonediff --git a/tests/unit/pipelex/tools/test_environment.py b/tests/unit/pipelex/tools/test_environment.pynew file mode 100644index 000000000..b66e56c20--- /dev/null+++ b/tests/unit/pipelex/tools/test_environment.py@@ -0,0 +1,130 @@+import os++import pytest+from pytest_mock import MockerFixture++from pipelex.tools.environment import (+ EnvVarNotFoundError,+ get_env_rooted_path,+ get_optional_env,+ get_required_env,+ get_rooted_path,+ set_env,+)+++class TestGetRequiredEnv:+ def test_get_required_env_success(self, mocker: MockerFixture):+ mocker.patch.dict(os.environ, {"TEST_VAR": "test_value"})+ result = get_required_env("TEST_VAR")+ assert result == "test_value"++ def test_get_required_env_missing_raises_error(self, mocker: MockerFixture):+ mocker.patch.dict(os.environ, {}, clear=True)+ with pytest.raises(EnvVarNotFoundError, match="Missing 'MISSING_VAR 'in environment."):+ get_required_env("MISSING_VAR")++ def test_get_required_env_empty_string_raises_error(self, mocker: MockerFixture):+ mocker.patch.dict(os.environ, {"EMPTY_VAR": ""})+ with pytest.raises(EnvVarNotFoundError, match="Missing 'EMPTY_VAR 'in environment."):+ get_required_env("EMPTY_VAR")+++class TestGetOptionalEnv:+ def test_get_optional_env_success(self, mocker: MockerFixture):+ mocker.patch.dict(os.environ, {"TEST_VAR": "test_value"})+ result = get_optional_env("TEST_VAR")+ assert result == "test_value"++ def test_get_optional_env_missing_returns_none(self, mocker: MockerFixture):+ mocker.patch.dict(os.environ, {}, clear=True)+ result = get_optional_env("MISSING_VAR")+ assert result is None++ def test_get_optional_env_empty_string_returns_empty_string(self, mocker: MockerFixture):+ mocker.patch.dict(os.environ, {"EMPTY_VAR": ""})+ result = get_optional_env("EMPTY_VAR")+ assert result == ""+++class TestSetEnv:+ def test_set_env_success(self):+ set_env("TEST_SET_VAR", "new_value")+ assert os.environ["TEST_SET_VAR"] == "new_value"++ def test_set_env_overwrites_existing(self):+ os.environ["EXISTING_VAR"] = "old_value"+ set_env("EXISTING_VAR", "new_value")+ assert os.environ["EXISTING_VAR"] == "new_value"+++class TestGetRootedPath:+ def test_get_rooted_path_none_path(self):+ result = get_rooted_path("/root")+ assert result == "/root"++ def test_get_rooted_path_empty_path(self):+ result = get_rooted_path("/root", "")+ assert result == "/root"++ def test_get_rooted_path_already_starts_with_root(self):+ result = get_rooted_path("/root", "/root/subdir")+ assert result == "/root/subdir"++ def test_get_rooted_path_absolute_path_different_root(self):+ result = get_rooted_path("/root", "/other/absolute/path")+ assert result == "/other/absolute/path"++ def test_get_rooted_path_relative_path(self):+ result = get_rooted_path("/root", "relative/path")+ assert result == "/root/relative/path"++ def test_get_rooted_path_removes_trailing_slash(self):+ result = get_rooted_path("/root", "subdir/")+ assert result == "/root/subdir"++ def test_get_rooted_path_keeps_root_without_trailing_slash(self):+ result = get_rooted_path("/root/", "")+ assert result == "/root"++ def test_get_rooted_path_absolute_check(self, mocker: MockerFixture):+ mock_isabs = mocker.patch("os.path.isabs", return_value=True)+ result = get_rooted_path("/root", "fake/absolute")+ assert result == "fake/absolute"+ mock_isabs.assert_called_once_with("fake/absolute")++ def test_get_rooted_path_join_called(self, mocker: MockerFixture):+ mock_join = mocker.patch("os.path.join", return_value="/root/relative")+ mocker.patch("os.path.isabs", return_value=False)+ result = get_rooted_path("/root", "relative")+ assert result == "/root/relative"+ mock_join.assert_called_once_with("/root", "relative")+++class TestGetEnvRootedPath:+ def test_get_env_rooted_path_with_env_var(self, mocker: MockerFixture):+ mocker.patch.dict(os.environ, {"ROOT_ENV": "/env/root"})+ result = get_env_rooted_path("ROOT_ENV", "subdir")+ assert result == "/env/root/subdir"++ def test_get_env_rooted_path_missing_env_var(self, mocker: MockerFixture):+ mocker.patch.dict(os.environ, {}, clear=True)+ result = get_env_rooted_path("MISSING_ROOT_ENV", "subdir")+ assert result == "subdir"++ def test_get_env_rooted_path_empty_env_var(self, mocker: MockerFixture):+ mocker.patch.dict(os.environ, {"EMPTY_ROOT_ENV": ""})+ result = get_env_rooted_path("EMPTY_ROOT_ENV", "subdir")+ assert result == "subdir"++ def test_get_env_rooted_path_none_path(self, mocker: MockerFixture):+ mocker.patch.dict(os.environ, {"ROOT_ENV": "/env/root"})+ result = get_env_rooted_path("ROOT_ENV")+ assert result == "/env/root"+++class TestEnvVarNotFoundError:+ def test_env_var_not_found_error_inheritance(self):+ error = EnvVarNotFoundError("test message")+ assert isinstance(error, Exception)+ assert str(error) == "test message"diff --git a/uv.lock b/uv.lockindex 7f570b1a4..113b5f7e9 100644--- a/uv.lock+++ b/uv.lock@@ -1619,7 +1619,7 @@ wheels = [[[package]]name = "pipelex"-version = "0.4.8"+version = "0.4.11"source = { editable = "." }dependencies = [{ name = "aiofiles" },