Skip to content

rtest fails when running tests in the pydantic repository #55

@hughhan1

Description

@hughhan1

Running rtest against the pydantic repository fails with TypeError: 'NoneType' object does not support item assignment on MacOS (and potentially other operating systems).

Steps to Reproduce

git clone https://github.com/pydantic/pydantic
cd pydantic
python3 -m venv .venv
source .venv/bin/activate
uv pip compile --group dev pyproject.toml -o requirements.txt
pip3 install -r requirements.txt
pip3 install pytest rtest

✅ Expected Behavior - pytest

[...]
Results (7.49s):
      5287 passed
      1012 skipped
        22 xfailed

❌ Unexpected Behavior - rtest

[...]
============================================================ FAILURES ============================================================
________________________________________________ test_on_validate_json_on_success ________________________________________________

    def test_on_validate_json_on_success() -> None:
        class CustomOnValidateJson(ValidateJsonHandlerProtocol):
            def on_enter(
                self,
                input: str | bytes | bytearray,
                *,
                strict: bool | None = None,
                context: dict[str, Any] | None = None,
                self_instance: Any | None = None,
                by_alias: bool | None = None,
                by_name: bool | None = None,
            ) -> None:
                assert input == '{"a": 1}'
                assert strict is None
                assert context is None
                assert self_instance is None
    
            def on_success(self, result: Any) -> None:
                assert isinstance(result, Model)
    
        class CustomPlugin(PydanticPluginProtocol):
            def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
                assert config == {'title': 'Model'}
                assert plugin_settings == {'observe': 'all'}
                assert schema_type.__name__ == 'Model'
                assert schema_type_path == SchemaTypePath(
                    'tests.test_plugins', 'test_on_validate_json_on_success.<locals>.Model'
                )
                assert schema_kind == 'BaseModel'
                return None, CustomOnValidateJson(), None
    
        plugin = CustomPlugin()
>       with install_plugin(plugin):

tests/test_plugins.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

plugin = <tests.test_plugins.test_on_validate_json_on_success.<locals>.CustomPlugin object at 0x10aa03a10>

    @contextlib.contextmanager
    def install_plugin(plugin: PydanticPluginProtocol) -> Generator[None, None, None]:
>       _plugins[plugin.__class__.__qualname__] = plugin
E       TypeError: 'NoneType' object does not support item assignment

tests/test_plugins.py:26: TypeError
_________________________________________________ test_on_validate_json_on_error _________________________________________________

    def test_on_validate_json_on_error() -> None:
        class CustomOnValidateJson:
            def on_enter(
                self,
                input: str | bytes | bytearray,
                *,
                strict: bool | None = None,
                context: dict[str, Any] | None = None,
                self_instance: Any | None = None,
                by_alias: bool | None = None,
                by_name: bool | None = None,
            ) -> None:
                assert input == '{"a": "potato"}'
                assert strict is None
                assert context is None
                assert self_instance is None
    
            def on_error(self, error: ValidationError) -> None:
                assert error.title == 'Model'
                assert error.errors(include_url=False) == [
                    {
                        'input': 'potato',
                        'loc': ('a',),
                        'msg': 'Input should be a valid integer, unable to parse string as an integer',
                        'type': 'int_parsing',
                    },
                ]
    
        class Plugin(PydanticPluginProtocol):
            def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
                assert config == {'title': 'Model'}
                assert plugin_settings == {'observe': 'all'}
                return None, CustomOnValidateJson(), None
    
        plugin = Plugin()
>       with install_plugin(plugin):

tests/test_plugins.py:111: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

plugin = <tests.test_plugins.test_on_validate_json_on_error.<locals>.Plugin object at 0x1088f8830>

    @contextlib.contextmanager
    def install_plugin(plugin: PydanticPluginProtocol) -> Generator[None, None, None]:
>       _plugins[plugin.__class__.__qualname__] = plugin
E       TypeError: 'NoneType' object does not support item assignment

tests/test_plugins.py:26: TypeError
_______________________________________________ test_on_validate_python_on_success _______________________________________________

    def test_on_validate_python_on_success() -> None:
        class CustomOnValidatePython(ValidatePythonHandlerProtocol):
            def on_enter(
                self,
                input: Any,
                *,
                strict: bool | None = None,
                from_attributes: bool | None = None,
                context: dict[str, Any] | None = None,
                self_instance: Any | None = None,
                by_alias: bool | None = None,
                by_name: bool | None = None,
            ) -> None:
                assert input == {'a': 1}
                assert strict is None
                assert context is None
                assert self_instance is None
    
            def on_success(self, result: Any) -> None:
                assert isinstance(result, Model)
    
        class Plugin:
            def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
                assert config == {'title': 'Model'}
                assert plugin_settings == {'observe': 'all'}
                assert schema_type.__name__ == 'Model'
                assert schema_kind == 'BaseModel'
                return CustomOnValidatePython(), None, None
    
        plugin = Plugin()
>       with install_plugin(plugin):

tests/test_plugins.py:151: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

plugin = <tests.test_plugins.test_on_validate_python_on_success.<locals>.Plugin object at 0x1088f8d70>

    @contextlib.contextmanager
    def install_plugin(plugin: PydanticPluginProtocol) -> Generator[None, None, None]:
>       _plugins[plugin.__class__.__qualname__] = plugin
E       TypeError: 'NoneType' object does not support item assignment

tests/test_plugins.py:26: TypeError
________________________________________________ test_on_validate_python_on_error ________________________________________________

    def test_on_validate_python_on_error() -> None:
        class CustomOnValidatePython(ValidatePythonHandlerProtocol):
            def on_enter(
                self,
                input: Any,
                *,
                strict: bool | None = None,
                from_attributes: bool | None = None,
                context: dict[str, Any] | None = None,
                self_instance: Any | None = None,
                by_alias: bool | None = None,
                by_name: bool | None = None,
            ) -> None:
                assert input == {'a': 'potato'}
                assert strict is None
                assert context is None
                assert self_instance is None
    
            def on_error(self, error: ValidationError) -> None:
                assert error.title == 'Model'
                assert error.errors(include_url=False) == [
                    {
                        'input': 'potato',
                        'loc': ('a',),
                        'msg': 'Input should be a valid integer, unable to parse string as an integer',
                        'type': 'int_parsing',
                    },
                ]
    
        class Plugin(PydanticPluginProtocol):
            def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
                assert config == {'title': 'Model'}
                assert plugin_settings == {'observe': 'all'}
                assert schema_type.__name__ == 'Model'
                assert schema_kind == 'BaseModel'
                return CustomOnValidatePython(), None, None
    
        plugin = Plugin()
>       with install_plugin(plugin):

tests/test_plugins.py:198: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

plugin = <tests.test_plugins.test_on_validate_python_on_error.<locals>.Plugin object at 0x10aa03a10>

    @contextlib.contextmanager
    def install_plugin(plugin: PydanticPluginProtocol) -> Generator[None, None, None]:
>       _plugins[plugin.__class__.__qualname__] = plugin
E       TypeError: 'NoneType' object does not support item assignment

tests/test_plugins.py:26: TypeError
______________________________________________________ test_stateful_plugin ______________________________________________________

    def test_stateful_plugin() -> None:
        stack: list[Any] = []
    
        class CustomOnValidatePython(ValidatePythonHandlerProtocol):
            def on_enter(
                self,
                input: Any,
                *,
                strict: bool | None = None,
                from_attributes: bool | None = None,
                context: dict[str, Any] | None = None,
                self_instance: Any | None = None,
                by_alias: bool | None = None,
                by_name: bool | None = None,
            ) -> None:
                stack.append(input)
    
            def on_success(self, result: Any) -> None:
                stack.pop()
    
            def on_error(self, error: Exception) -> None:
                stack.pop()
    
            def on_exception(self, exception: Exception) -> None:
                stack.pop()
    
        class Plugin(PydanticPluginProtocol):
            def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
                return CustomOnValidatePython(), None, None
    
        plugin = Plugin()
    
        class MyException(Exception):
            pass
    
>       with install_plugin(plugin):

tests/test_plugins.py:243: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

plugin = <tests.test_plugins.test_stateful_plugin.<locals>.Plugin object at 0x1088f8830>

    @contextlib.contextmanager
    def install_plugin(plugin: PydanticPluginProtocol) -> Generator[None, None, None]:
>       _plugins[plugin.__class__.__qualname__] = plugin
E       TypeError: 'NoneType' object does not support item assignment

tests/test_plugins.py:26: TypeError
_______________________________________________________ test_all_handlers ________________________________________________________

    def test_all_handlers():
        log = []
    
        class Python(ValidatePythonHandlerProtocol):
            def on_enter(self, input, **kwargs) -> None:
                log.append(f'python enter input={input} kwargs={kwargs}')
    
            def on_success(self, result: Any) -> None:
                log.append(f'python success result={result}')
    
            def on_error(self, error: ValidationError) -> None:
                log.append(f'python error error={error}')
    
        class Json(ValidateJsonHandlerProtocol):
            def on_enter(self, input, **kwargs) -> None:
                log.append(f'json enter input={input} kwargs={kwargs}')
    
            def on_success(self, result: Any) -> None:
                log.append(f'json success result={result}')
    
            def on_error(self, error: ValidationError) -> None:
                log.append(f'json error error={error}')
    
        class Strings(ValidateStringsHandlerProtocol):
            def on_enter(self, input, **kwargs) -> None:
                log.append(f'strings enter input={input} kwargs={kwargs}')
    
            def on_success(self, result: Any) -> None:
                log.append(f'strings success result={result}')
    
            def on_error(self, error: ValidationError) -> None:
                log.append(f'strings error error={error}')
    
        class Plugin(PydanticPluginProtocol):
            def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
                return Python(), Json(), Strings()
    
        plugin = Plugin()
>       with install_plugin(plugin):

tests/test_plugins.py:302: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

plugin = <tests.test_plugins.test_all_handlers.<locals>.Plugin object at 0x1088f8c20>

    @contextlib.contextmanager
    def install_plugin(plugin: PydanticPluginProtocol) -> Generator[None, None, None]:
>       _plugins[plugin.__class__.__qualname__] = plugin
E       TypeError: 'NoneType' object does not support item assignment

tests/test_plugins.py:26: TypeError
___________________________________________________ test_plugin_path_dataclass ___________________________________________________

    def test_plugin_path_dataclass() -> None:
        class CustomOnValidatePython(ValidatePythonHandlerProtocol):
            pass
    
        class Plugin:
            def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
                assert schema_type.__name__ == 'Bar'
                assert schema_type_path == SchemaTypePath('tests.test_plugins', 'test_plugin_path_dataclass.<locals>.Bar')
                assert schema_kind == 'dataclass'
                return CustomOnValidatePython(), None, None
    
        plugin = Plugin()
>       with install_plugin(plugin):

tests/test_plugins.py:338: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

plugin = <tests.test_plugins.test_plugin_path_dataclass.<locals>.Plugin object at 0x1088f8ec0>

    @contextlib.contextmanager
    def install_plugin(plugin: PydanticPluginProtocol) -> Generator[None, None, None]:
>       _plugins[plugin.__class__.__qualname__] = plugin
E       TypeError: 'NoneType' object does not support item assignment

tests/test_plugins.py:26: TypeError
_________________________________________________ test_plugin_path_type_adapter __________________________________________________

    def test_plugin_path_type_adapter() -> None:
        class CustomOnValidatePython(ValidatePythonHandlerProtocol):
            pass
    
        class Plugin:
            def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
                assert str(schema_type) == 'list[str]'
                assert schema_type_path == SchemaTypePath('tests.test_plugins', 'list[str]')
                assert schema_kind == 'TypeAdapter'
                return CustomOnValidatePython(), None, None
    
        plugin = Plugin()
>       with install_plugin(plugin):

tests/test_plugins.py:357: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

plugin = <tests.test_plugins.test_plugin_path_type_adapter.<locals>.Plugin object at 0x1088f8ad0>

    @contextlib.contextmanager
    def install_plugin(plugin: PydanticPluginProtocol) -> Generator[None, None, None]:
>       _plugins[plugin.__class__.__qualname__] = plugin
E       TypeError: 'NoneType' object does not support item assignment

tests/test_plugins.py:26: TypeError
___________________________________________ test_plugin_path_type_adapter_with_module ____________________________________________

    def test_plugin_path_type_adapter_with_module() -> None:
        class CustomOnValidatePython(ValidatePythonHandlerProtocol):
            pass
    
        class Plugin:
            def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
                assert str(schema_type) == 'list[str]'
                assert schema_type_path == SchemaTypePath('provided_module_by_type_adapter', 'list[str]')
                assert schema_kind == 'TypeAdapter'
                return CustomOnValidatePython(), None, None
    
        plugin = Plugin()
>       with install_plugin(plugin):

tests/test_plugins.py:374: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

plugin = <tests.test_plugins.test_plugin_path_type_adapter_with_module.<locals>.Plugin object at 0x1088f9010>

    @contextlib.contextmanager
    def install_plugin(plugin: PydanticPluginProtocol) -> Generator[None, None, None]:
>       _plugins[plugin.__class__.__qualname__] = plugin
E       TypeError: 'NoneType' object does not support item assignment

tests/test_plugins.py:26: TypeError
_____________________________________ test_plugin_path_type_adapter_without_name_in_globals ______________________________________

    def test_plugin_path_type_adapter_without_name_in_globals() -> None:
        class CustomOnValidatePython(ValidatePythonHandlerProtocol):
            pass
    
        class Plugin:
            def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
                assert str(schema_type) == 'list[str]'
                assert schema_type_path == SchemaTypePath('', 'list[str]')
                assert schema_kind == 'TypeAdapter'
                return CustomOnValidatePython(), None, None
    
        plugin = Plugin()
>       with install_plugin(plugin):

tests/test_plugins.py:390: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

plugin = <tests.test_plugins.test_plugin_path_type_adapter_without_name_in_globals.<locals>.Plugin object at 0x10aa03a10>

    @contextlib.contextmanager
    def install_plugin(plugin: PydanticPluginProtocol) -> Generator[None, None, None]:
>       _plugins[plugin.__class__.__qualname__] = plugin
E       TypeError: 'NoneType' object does not support item assignment

tests/test_plugins.py:26: TypeError
_________________________________________________ test_plugin_path_validate_call _________________________________________________

    def test_plugin_path_validate_call() -> None:
        class CustomOnValidatePython(ValidatePythonHandlerProtocol):
            pass
    
        class Plugin1:
            def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
                assert schema_type.__name__ == 'foo'
                assert schema_type_path == SchemaTypePath(
                    'tests.test_plugins', 'test_plugin_path_validate_call.<locals>.foo'
                )
                assert schema_kind == 'validate_call'
                return CustomOnValidatePython(), None, None
    
        plugin = Plugin1()
>       with install_plugin(plugin):

tests/test_plugins.py:412: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

plugin = <tests.test_plugins.test_plugin_path_validate_call.<locals>.Plugin1 object at 0x1088f8ec0>

    @contextlib.contextmanager
    def install_plugin(plugin: PydanticPluginProtocol) -> Generator[None, None, None]:
>       _plugins[plugin.__class__.__qualname__] = plugin
E       TypeError: 'NoneType' object does not support item assignment

tests/test_plugins.py:26: TypeError
_________________________________________________ test_plugin_path_create_model __________________________________________________

    def test_plugin_path_create_model() -> None:
        class CustomOnValidatePython(ValidatePythonHandlerProtocol):
            pass
    
        class Plugin:
            def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
                assert schema_type.__name__ == 'FooModel'
                assert list(schema_type.model_fields.keys()) == ['foo', 'bar']
                assert schema_type_path == SchemaTypePath('tests.test_plugins', 'FooModel')
                assert schema_kind == 'create_model'
                return CustomOnValidatePython(), None, None
    
        plugin = Plugin()
>       with install_plugin(plugin):

tests/test_plugins.py:450: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

plugin = <tests.test_plugins.test_plugin_path_create_model.<locals>.Plugin object at 0x1088f8c20>

    @contextlib.contextmanager
    def install_plugin(plugin: PydanticPluginProtocol) -> Generator[None, None, None]:
>       _plugins[plugin.__class__.__qualname__] = plugin
E       TypeError: 'NoneType' object does not support item assignment

tests/test_plugins.py:26: TypeError
____________________________________________________ test_plugin_path_complex ____________________________________________________

    def test_plugin_path_complex() -> None:
        paths: list[tuple(str, str)] = []
    
        class CustomOnValidatePython(ValidatePythonHandlerProtocol):
            pass
    
        class Plugin:
            def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
                paths.append((schema_type.__name__, schema_type_path, schema_kind))
                return CustomOnValidatePython(), None, None
    
        plugin = Plugin()
>       with install_plugin(plugin):

tests/test_plugins.py:466: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/contextlib.py:141: in __enter__
    return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

plugin = <tests.test_plugins.test_plugin_path_complex.<locals>.Plugin object at 0x1088f8830>

    @contextlib.contextmanager
    def install_plugin(plugin: PydanticPluginProtocol) -> Generator[None, None, None]:
>       _plugins[plugin.__class__.__qualname__] = plugin
E       TypeError: 'NoneType' object does not support item assignment

tests/test_plugins.py:26: TypeError
                                                       Summary of Failures                                                        
┏━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓
┃  File                   ┃  Function                                             ┃  Function Line  ┃  Error Line  ┃  Error      ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩
│  tests/test_plugins.py  │  test_on_validate_json_on_success                     │  33             │  65          │  TypeError  │
│  tests/test_plugins.py  │  test_on_validate_json_on_error                       │  76             │  111         │  TypeError  │
│  tests/test_plugins.py  │  test_on_validate_python_on_success                   │  121            │  151         │  TypeError  │
│  tests/test_plugins.py  │  test_on_validate_python_on_error                     │  160            │  198         │  TypeError  │
│  tests/test_plugins.py  │  test_stateful_plugin                                 │  208            │  243         │  TypeError  │
│  tests/test_plugins.py  │  test_all_handlers                                    │  264            │  302         │  TypeError  │
│  tests/test_plugins.py  │  test_plugin_path_dataclass                           │  326            │  338         │  TypeError  │
│  tests/test_plugins.py  │  test_plugin_path_type_adapter                        │  345            │  357         │  TypeError  │
│  tests/test_plugins.py  │  test_plugin_path_type_adapter_with_module            │  362            │  374         │  TypeError  │
│  tests/test_plugins.py  │  test_plugin_path_type_adapter_without_name_in_glob…  │  378            │  390         │  TypeError  │
│  tests/test_plugins.py  │  test_plugin_path_validate_call                       │  398            │  412         │  TypeError  │
│  tests/test_plugins.py  │  test_plugin_path_create_model                        │  437            │  450         │  TypeError  │
│  tests/test_plugins.py  │  test_plugin_path_complex                             │  454            │  466         │  TypeError  │
└─────────────────────────┴───────────────────────────────────────────────────────┴─────────────────┴──────────────┴─────────────┘
Results (7.82s):
        13 failed
      5274 passed
      1012 skipped
        22 xfailed

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions