Pytest Frappe Plugin - A set of pytest fixtures to test Frappe applications
Project description
pytest-frappe
pytest-frappe is a set of pytest fixtures for testing Frappe applications. It provides two fixtures: db_instance and db_transaction, which can be used to create and manage database connections.
Installation
You can install pytest-frappe via pip:
pip install pytest-frappe
Usage
To use the fixtures provided by pytest-frappe
def test_foo(db_transaction):
# use the db_instance fixture to interact with the database
pass
pytest-frappe also provides a command line option, --sites-path, which can be used to specify the directory where your Frappe sites are stored. This option is required to initialize the db_instance fixture.
Here's an example of how you can use the --sites-path option:
pytest --sites-path=/path/to/sites/directory
Available fixtures
db_instance
The db_instance fixture provides a database connection to a Frappe application. It is created at the beginning of the test session and destroyed at the end of the session. This fixture is used to perform database operations.
db_transaction
The db_transaction fixture is a database transaction context manager. It creates a new transaction at the beginning of each test function and rolls back the transaction at the end of the test function. This fixture is used to perform database operations within a transaction.
License
pytest-frappe is licensed under the MIT License. See LICENSE for more information.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest-frappe-0.2.5.tar.gz.
File metadata
- Download URL: pytest-frappe-0.2.5.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b658b29aca082b077114a90b418f0f728042176cda07fefa3cce7ebebebeaec8
|
|
| MD5 |
dc5afbafe21581f6211cff894f8a967b
|
|
| BLAKE2b-256 |
deafdc58cbeb8d434e6ed8779138eb8c95cb7e421a619665624d4c5026f8cf17
|
File details
Details for the file pytest_frappe-0.2.5-py3-none-any.whl.
File metadata
- Download URL: pytest_frappe-0.2.5-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18555494c69a2272619f98c6913cbdf7df4f9ba0a7de2f0096d30f05a4885a80
|
|
| MD5 |
768097fe9074f21bf5c1d4a0a1269654
|
|
| BLAKE2b-256 |
a87f5a0f42b20fb8d99c3ff80102bc3cc60f7d4aab7ecca20983c2728eefac61
|