pytest-flask-sqlalchemy icon indicating copy to clipboard operation
pytest-flask-sqlalchemy copied to clipboard

A pytest plugin for preserving test isolation in Flask-SQLAlchemy using database transactions.

Results 32 pytest-flask-sqlalchemy issues
Sort by recently updated
recently updated
newest added
trafficstars

I want to use pytest-flask-sqlalchemy with fixtures with `scope='module'` For example i have creating user: ```python @pytest.fixture(scope='module') def user(db_session): user = User( username='My user', ) db_session.add(user) db_session.commit() return user ```...

It would be useful to see an example of how to use pytest-flask-sqlalchemy with FactoryBoy/pytest-factoryboy, if they can work together. For example, I'm not clear what would be used for...

question

Hi, I've trying to connect to my real MSSQL database in docker with the following fixtures. I omit the DB creation part for now just to simplify things. But I...

With 1.3: https://github.com/codeforboston/police-data-trust/actions/runs/1006498785 With 1.4: https://github.com/codeforboston/police-data-trust/actions/runs/1006417486 The error message received in 1.4: `AttributeError: Mock object has no attribute '_contextual_connect'`

This is a bit of a bodge, but fixes #50 for me.

I am using the application factory pattern as described in the flask docs: https://flask.palletsprojects.com/en/1.1.x/patterns/appfactories/ , e.g.: ```python def create_app(): app = Flask(__name__) from yourapplication.model import db db.init_app(app) ``` As described...

just like in #5 this happens again with latest versions, unfortunately #6 did not resolve this completely. When I delete an object via a client call I receive the notorious...

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 ```python class...

Code that uses [SQLAlchemy's Reflection facilities](https://docs.sqlalchemy.org/en/14/core/reflection.html) won't work with a monkey patched database engine. code like this: ```python messages = Table('messages', meta, autoload_with=engine) ``` raises the error `sqlalchemy.exc.NoInspectionAvailable: No inspection...

Fixes #53 Also fixes extra savepoints from #45 `_connection_for_bind` caches not `bind` directly but `conn` and `conn.engine` https://github.com/sqlalchemy/sqlalchemy/blob/rel_1_3_24/lib/sqlalchemy/orm/session.py#L453 because we're mocking `session.bind` with MagicMock it never gets into the `_connections`...