No project description provided
Project description
TestDB
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 schema 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 testdb 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)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file spawndb-0.1.14.tar.gz
.
File metadata
- Download URL: spawndb-0.1.14.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0a2 CPython/3.8.10 Linux/5.13.0-28-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3011416cce1dcd6d896674be2e04f9d7cad26359977c5fa4402da13548482eca |
|
MD5 | dc95cb6c9ab776692ec849366e95c5a6 |
|
BLAKE2b-256 | 5c013582f046802cdc78e43630ba8cfb8174bd0df5418264932c2e577c95eb1a |
File details
Details for the file spawndb-0.1.14-py3-none-any.whl
.
File metadata
- Download URL: spawndb-0.1.14-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0a2 CPython/3.8.10 Linux/5.13.0-28-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e42d021f3c12ff0c3b9c556f78804d98352961f30b9f73e5ca32e29d8346b380 |
|
MD5 | 1bb535f2def826fd47982aeb350fbac3 |
|
BLAKE2b-256 | 9bfa58455d0c9641415d5636a73407e2aef56451ccf0369df9b1b29c25cc9215 |