pytest-sqlalchemy
SQLAlchemy related fixtures to handle connections and transactions with SQLAlchemy in tests.
Fixtures
This plugin provides the following fixtures:
- engine The engine used to connect to the database. Scope is "module".
- connection An open connection to the database. Scope is "module".
- transaction A started transaction on the connection. Transaction will be rolled back. No Scope.
- dbsession A sqlalchemy session not bound to any model. No scope.
Invoke
You need to provide the connection URL for the engine when invoking the pytest command::
py-test --sqlalchemy-connect-url="postgresql://scott:tiger@localhost:5432/mydatabase"