Skip to main content

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.

Release files for pytest-frappe 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-frappe 0.2.5
File Size Uploaded
pytest-frappe-0.2.5.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-frappe 0.2.5
File Interpreter ABI Platform
pytest_frappe-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 9.3 kB

Release files / pytest-frappe-0.2.5.tar.gz

Download URL pytest-frappe-0.2.5.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b658b29aca082b077114a90b418f0f728042176cda07fefa3cce7ebebebeaec8
BLAKE2b-256 checksum
How to use checksums
deafdc58cbeb8d434e6ed8779138eb8c95cb7e421a619665624d4c5026f8cf17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release files / pytest_frappe-0.2.5-py3-none-any.whl

Download URL pytest_frappe-0.2.5-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18555494c69a2272619f98c6913cbdf7df4f9ba0a7de2f0096d30f05a4885a80
BLAKE2b-256 checksum
How to use checksums
a87f5a0f42b20fb8d99c3ff80102bc3cc60f7d4aab7ecca20983c2728eefac61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.28.2

Release history Release notifications | RSS feed

This release

0.2.5 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page