11from pathlib import Path
22
3- import pytest
43from pydantic import BaseModel
54from pytest_mock import MockerFixture
65
109class TestClassRegistryUtilsUnit :
1110 """Unit tests for ClassRegistryUtils using mocks."""
1211
13- @pytest .mark .xfail (reason = "No idea why this is failing" )
1412 def test_register_classes_in_file (self , mocker : MockerFixture ):
1513 """Test registering classes from a Python file."""
1614 # Mock the module utilities to avoid complex file operations
@@ -25,18 +23,12 @@ def test_register_classes_in_file(self, mocker: MockerFixture):
2523 mock_registry = mocker .MagicMock ()
2624 mocker .patch ("pipelex.tools.class_registry_utils.get_class_registry" , return_value = mock_registry )
2725
28- # Mock sys.modules for cleanup verification
29- mock_sys_modules = mocker .patch ("pipelex.tools.class_registry_utils.sys.modules" , spec = dict )
30-
3126 ClassRegistryUtils .register_classes_in_file (file_path = "/fake/path.py" , base_class = None , is_include_imported = False )
3227
3328 # Verify the mocked functions were called correctly
3429 mock_import .assert_called_once_with ("/fake/path.py" )
3530 mock_find .assert_called_once_with (module = mock_module , base_class = None , include_imported = False )
3631
37- # Verify sys.modules cleanup
38- mock_sys_modules .__delitem__ .assert_called_once_with ("test_module" )
39-
4032 # Verify classes were registered with the global registry
4133 mock_registry .register_classes .assert_called_once_with (classes = [str , int ])
4234
0 commit comments