Skip to content

test_render_mock_ddl fails on Python 3.13 #764

@mweinelt

Description

@mweinelt

Hi!

With Python 3.13 we are seeing the following test failure. The test works fine on Python 3.12.7.

_______________________ TestRender.test_render_mock_ddl ________________________

self = <tests.functions.test_render.TestRender object at 0x7ffff3b6be30>
engine = Engine(sqlite:///:memory:)
User = <class 'tests.functions.test_render.TestRender.User.<locals>.User'>

    def test_render_mock_ddl(self, engine, User):
        # TODO: mock_engine doesn't seem to work with locally scoped variables.
        self.engine = engine
>       with mock_engine('self.engine') as stream:

tests/functions/test_render.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/nix/store/0b83hlniyfbpha92k2j0w93mxdalv8kb-python3-3.13.0/lib/python3.13/contextlib.py:148: in __exit__
    next(self.gen)
sqlalchemy_utils/functions/mock.py:111: in mock_engine
    exec('del __target', frame.f_globals, frame.f_locals)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   NameError: name '__target' is not defined

<string>:1: NameError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions