pytest-cratedb-reporter

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pytest-cratedb-reporter

A pytest plugin for reporting test results to CrateDB

0.1.0
100

Supply Chain Security

100

Vulnerability

99

Quality

100

Maintenance

100

License

Maintainers
1

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:

ColumnTypeDescription
idSRINGPrimary key (UUID).
nodeidSTRINGThe test node ID.
outcomeSTRINGThe test outcome (e.g., passed, failed).
messageTEXTThe test message (if applicable).
backtraceTEXTThe test backtrace (if applicable).
durationINTEGERThe test duration in milliseconds.
timestampDATETIMEThe timestamp of the test execution.
passedBOOLEANTrue if the test passed, False otherwise.
failedBOOLEANTrue 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.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts