jeancochrane / pytest-flask-sqlalchemy

A pytest plugin for preserving test isolation in Flask-SQLAlchemy using database transactions.
MIT License
255 stars 45 forks source link

Get reflection working for SA 1.4 #56

Open fgregg opened 3 years ago

fgregg commented 3 years ago

Working on getting reflection for SA 1.4, will close #55

Also adds an mocked patch for execution_options

This would be cleaner and more specific if it was like

    class EngineMock(mocker.MagicMock):
        pass
    engine = EngineMock(spec=sa.engine.Engine)
    ...
    if version.parse(sa.__version__) >= version.parse('1.4'):
        sa.inspection._registrars[EngineMock] = sa.engine.Inspector._engine_insp

but, somehow subclassing MagicMock like this interferes with the tests from running.

fgregg commented 3 years ago

First need to figure out why tests are not passing. Probably should remove cybergrind's code and isolate what i'm working with.

It was trying to subclass mocker.MagicMock to EngineMock.