A pytest plugin for reporting test results to CrateDB
Project description
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.
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_cratedb_reporter-0.1.0.tar.gz.
File metadata
- Download URL: pytest_cratedb_reporter-0.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a598fa11b264ad9acfbf82ba48ef7ec4dbda49adc8ed0f9fc25518cf624960c
|
|
| MD5 |
98b6bd1b993d57a01a9c562d549893b1
|
|
| BLAKE2b-256 |
a258a43cef01eb3ddb6aa7ea5a2b797fc8aa364462d0e71ed17684fde47e2d21
|
File details
Details for the file pytest_cratedb_reporter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pytest_cratedb_reporter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
80530856cf43d3796ab8efd647ce653a26efa1fa8447d1c6583a3e33d176dda0
|
|
| MD5 |
74d1e89bb748051dfcaeb68c9b98a086
|
|
| BLAKE2b-256 |
9c122ea7cb69f8dedb4c6e9c280222a617c77a5baccdfb970205ec46d37b4425
|