Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/illume/sqlalchemy_pytest_fixtures
sqlalchemy pytest fixtures
https://github.com/illume/sqlalchemy_pytest_fixtures
Last synced: about 2 months ago
JSON representation
sqlalchemy pytest fixtures
- Host: GitHub
- URL: https://github.com/illume/sqlalchemy_pytest_fixtures
- Owner: illume
- License: mit
- Created: 2018-06-04T06:40:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-04T06:42:32.000Z (over 6 years ago)
- Last Synced: 2024-10-12T12:45:23.872Z (3 months ago)
- Language: Python
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
sqlalchemy pytest fixtures
The benefits for these are they can::
* makes writing sql tests easy, fast, and robust.
* Run in parallel, in separate schemas per connection.
* Only create the tables once for each pytest session.Example::
>>> def test_bla(session):
from bla.models import Bla
bla = Bla(name="hell")
assert bla.name == 'hell'
session.add(bla)
session.commit()Here you can see the nesting of transactions and db code as it happens.
Creates an engine per pytest.session.
Creates a connection per pytest.session.
transaction
create unique schema for these tests
create tables
nested transaction
sqlalchemy.session
user test code.