Skip to main content

pytest-cratedb-reporter

A pytest plugin that writes test results to a CrateDB database.

Installation

pip install pytest-cratedb-reporter

Usage

Run pytest with the cratedb-url option:

pytest --cratedb-url="crate://<host>:<port>" your_tests.py

Replace host and port with your CrateDB server details. For example:

pytest --cratedb-url=crate://localhost:4200 example/test_example.py

Verify Results:

The plugin will create a table named test_results in your CrateDB database (if it doesn't already exist) and populate it with test result data. You can query the table to view the results.

Configuration

--cratedb-url:

  • Specifies the CrateDB connection URL.
  • Example: crate://localhost:4200

Database Schema

The plugin uses the following schema for the test_results table:

Column Type Description
id SRING Primary key (UUID).
nodeid STRING The test node ID.
outcome STRING The test outcome (e.g., passed, failed).
message TEXT The test message (if applicable).
backtrace TEXT The test backtrace (if applicable).
duration INTEGER The test duration in milliseconds.
timestamp DATETIME The timestamp of the test execution.
passed BOOLEAN True if the test passed, False otherwise.
failed BOOLEAN True if the test failed, False otherwise.

Example queries

-- Select all test results:
SELECT * FROM test_results;

-- Select failed tests:
SELECT * FROM test_results WHERE failed = true;

-- Select tests with a duration over 1 second:
SELECT * FROM test_results WHERE duration > 1000;

Development

Clone the repository:

git clone https://github.com/themodelarchitect/pytest-cratedb-reporter.git
cd pytest-cratedb-reporter

Create a virtual environment:

python -m venv venv
source venv/bin/activate

Install dependencies:

pip install -e .
pip install -r requirements.txt

Run tests:

pytest --cratedb-url="crate://<host>:<port>"

Contribute:

Feel free to submit pull requests with improvements or bug fixes.

License

This project is licensed under the MIT License.

Metadata

Release files for pytest-cratedb-reporter 0.1.0

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-cratedb-reporter 0.1.0
File Size Uploaded
pytest_cratedb_reporter-0.1.0.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-cratedb-reporter 0.1.0
File Interpreter ABI Platform
pytest_cratedb_reporter-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / pytest_cratedb_reporter-0.1.0.tar.gz

Download URL pytest_cratedb_reporter-0.1.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5a598fa11b264ad9acfbf82ba48ef7ec4dbda49adc8ed0f9fc25518cf624960c
BLAKE2b-256 checksum
How to use checksums
a258a43cef01eb3ddb6aa7ea5a2b797fc8aa364462d0e71ed17684fde47e2d21
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Release files / pytest_cratedb_reporter-0.1.0-py3-none-any.whl

Download URL pytest_cratedb_reporter-0.1.0-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
80530856cf43d3796ab8efd647ce653a26efa1fa8447d1c6583a3e33d176dda0
BLAKE2b-256 checksum
How to use checksums
9c122ea7cb69f8dedb4c6e9c280222a617c77a5baccdfb970205ec46d37b4425
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

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