schireson / pytest-mock-resources

Pytest Fixtures that let you actually test against external resource (Postgres, Mongo, Redshift...) dependent code.
https://pytest-mock-resources.readthedocs.io/en/latest/quickstart.html
MIT License
179 stars 19 forks source link

Support SQLAlchemy 1.4 future mode #177

Closed mje-nz closed 1 year ago

mje-nz commented 1 year ago

Is your feature request related to a problem? Please describe. SQLAlchemy 1.4 Engines and Sessions have a future mode which we're supposed to use to prepare for 2.0, but PMR doesn't support passing additional parameters to Engine.__init__, so we can't enable it for our tests.

Describe the solution you'd like Either a future: bool parameter to MysqlConfig and PostgresConfig which sets future on Engines and Sessions, or an engine_options: dict parameter to allow arbitrary extra parameters for Engine.__init__ (and then we can use a sessionmaker to futurize the Session)? I'm happy to implement it, I just don't want to step on anyone's toes.

DanCardin commented 1 year ago

i believe postgres supports an engine_kwargs argument create_postgres_fixture(engine_kwargs={...}) . although you're right, i dont think mysql currently has it implemented

DanCardin commented 1 year ago

I believe the session=True argument also accepts a sessionmaker/Session cls. So you can also customize the sort of session object you get back that way, for what it's worth.

DanCardin commented 1 year ago

v2.6.6 Adds support to mysql. Lmk if this doesn't do it for you and I can reopen

mje-nz commented 1 year ago

Perfect, thanks :)