Database management and testing for SQLAlchemy-based Flask apps.
Project description
Fuisce
Database management and testing for SQLAlchemy-based Flask apps.
Why Fuisce?
Fuisce, or whiskey in Irish, is probably not going to grant you eternal life... but it may extend the longevity of your SQLAlchemy-based Flask app. The package is designed to be a lightweight addition to any application, performing some of the database setup operations while coordinating database management for robust test suites.
For example, the current edition of the Flask documentation suggests creating a temporary SQLite database for each test.
This is perfectly fine for simple applications, but adds substantial overhead (and test time) to applications with many tests, especially those if it is desirable to have that database contain some preloaded information.
Instead, it would be preferable to create and use one temporary database instance for the majority of tests that only require read-access to the database, and then only create additional test databases for the tests that modify the state of the database (e.g., SQLAlchemy transactions).[^mocking]
Fuisce provides the infrastructure to create databases in both of these cases: a "persistent" database for read-only tests, and "ephemeral" databases for each transaction).
The persistent test database is used by default, but a transaction_lifetime
decorator can be used to indicate that a given test should use an ephemeral copy.
[^mocking]: Yes, you could also just not create databases and mock the database return functions, but my experience has been that it is even more tedious to maintain a comprehensive set of mocked data to test various intricacies and edge cases while simultaneously ensuring that the mocks behave similarly enough to SQLAlchemy objects.
Installation
Fuisce is registered on the Python Package Index (PyPI) for easy installation. To install the package, simply run
pip install fuisce
The package requires a recent version of Python (3.9+).
Usage
For an up-to-date API reference, build and read the docs:
make docs
# open `docs/build/html/index.html` in your browser
More details on using the Fuisce package are forthcoming...
License
This project is licensed under the GNU General Public License, Version 3. It is fully open-source, and while you are more than welcome to fork, add, modify, etc. it is required that you keep any distributed changes and additions open-source.
Changes
Changes between versions are tracked in the changelog.
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 fuisce-1.0.2.tar.gz
.
File metadata
- Download URL: fuisce-1.0.2.tar.gz
- Upload date:
- Size: 25.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.24.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce21d0444233c636a18254f5c3a6665090a282d89e7e8c2e253b3af0256f0ed0 |
|
MD5 | 2ffa424bbac10984f3d340e37d78dd09 |
|
BLAKE2b-256 | e8da8ef3825de22e51f9d68f3e336872e369452a9d1ed06ddc74b26fa1c5b377 |
File details
Details for the file fuisce-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: fuisce-1.0.2-py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.24.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfa3191d9cdc910ae4d19ea5c44cfb3d09a499da1dfe05cb072c7284cb84a959 |
|
MD5 | 560af9598efafd8cf81ad597e07a9e99 |
|
BLAKE2b-256 | f43e4a76e3e98ca642415a980030f74dbf34c96f6e80dbd0f7e44cf479024494 |