Skip to content

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.

Fixed one broken unit test

Louis Choquel43cef0c0f1cf
diff --git a/tests/unit/pipelex/tools/test_class_registry_utils.py b/tests/unit/pipelex/tools/test_class_registry_utils.py
index f44f32395..606e510c7 100644
--- a/tests/unit/pipelex/tools/test_class_registry_utils.py
+++ b/tests/unit/pipelex/tools/test_class_registry_utils.py
@@ -1,6 +1,5 @@
from pathlib import Path
-import pytest
from pydantic import BaseModel
from pytest_mock import MockerFixture
@@ -10,7 +9,6 @@ from pipelex.tools.class_registry_utils import ClassRegistryUtils
class TestClassRegistryUtilsUnit:
"""Unit tests for ClassRegistryUtils using mocks."""
- @pytest.mark.xfail(reason="No idea why this is failing")
def test_register_classes_in_file(self, mocker: MockerFixture):
"""Test registering classes from a Python file."""
# Mock the module utilities to avoid complex file operations
@@ -25,18 +23,12 @@ class TestClassRegistryUtilsUnit:
mock_registry = mocker.MagicMock()
mocker.patch("pipelex.tools.class_registry_utils.get_class_registry", return_value=mock_registry)
- # Mock sys.modules for cleanup verification
- mock_sys_modules = mocker.patch("pipelex.tools.class_registry_utils.sys.modules", spec=dict)
-
ClassRegistryUtils.register_classes_in_file(file_path="/fake/path.py", base_class=None, is_include_imported=False)
# Verify the mocked functions were called correctly
mock_import.assert_called_once_with("/fake/path.py")
mock_find.assert_called_once_with(module=mock_module, base_class=None, include_imported=False)
- # Verify sys.modules cleanup
- mock_sys_modules.__delitem__.assert_called_once_with("test_module")
-
# Verify classes were registered with the global registry
mock_registry.register_classes.assert_called_once_with(classes=[str, int])