SpawnDB
This is a simple library that helps in the creation of test databases for Python projects that use SQLAlchemy.
It's aim it's to seamlessly handle creation of a separate test database, including the creation of all schemas, their objects and finally, handling the destruction of the test database when it's no longer needed.
Usage
To create a test database, use the init_test_db function.
This function expects two arguments:
- database_url: sqlalchemy.engine.URL
- metadata: sqlalchemy.schema.MetaData
It will return an instantiated Engine for the test database which you can use for your database logics.
# Sample usage for Pytest
from spawndb import init_test_db, destroy_test_db
def my_cool_test():
db_engine = init_test_db(database_url, sqla_metadata)
try:
# your stuff goes here
finally:
destroy_test_db(database_url)
Release files for spawndb 0.1.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| spawndb-0.1.18.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spawndb-0.1.18-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.9 kB
Release files / spawndb-0.1.18.tar.gz
| Download URL | spawndb-0.1.18.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9be73c77f72abad82c7a0f56e71a8a1e0dbd1e18abb1837c2a9ece1a25458693
|
|
BLAKE2b-256 checksum How to use checksums |
89325072deadcdcd5c139d9214f03f4d7a48e46fbd510c7532b425f85628e97b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.9.16 Darwin/22.2.0
|
Release files / spawndb-0.1.18-py3-none-any.whl
| Download URL | spawndb-0.1.18-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
118aef0be8e6b28bc89b3ffd918894929a52e90dfeb7cabb0b1c6aecefef4af5
|
|
BLAKE2b-256 checksum How to use checksums |
12bfd1c89df37b9172f4d15ece77c61117dd0b05403c9fdef9c98ad7dc3d9c1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.2 CPython/3.9.16 Darwin/22.2.0
|