pytest-tinybird
A pytest plugin to report test results to Tinybird. At the end of every run, this plugin posts results using the Tinybird Events API.
Requirements
- Python >=3.8
- pytest 3.8 or newer (previous versions might be compatible)
- Tinybird account and a token with append permissions
Installation
pypi install package: https://pypi.org/project/pytest-tinybird/
You can install the plugin with the following bash command:
$ pip install pytest-tinybird
Usage
You just need your Tinybird account and a Token with append permissions
Set these env variables:
export TINYBIRD_URL=<https://api.tinybird.co|https://api.us-east.tinybird.co> # depends on your region
export TINYBIRD_DATASOURCE=<datasource_name> # will be created with first results posted
export TINYBIRD_TOKEN=<token_with_append_permissions>
Then run pytest with --report-to-tinybird.
$ pytest tests --report-to-tinybird
CI execution info can also be set using some env variables. These are from GitLab:
CI_COMMIT_SHA
CI_COMMIT_BRANCH
CI_JOB_ID
CI_JOB_NAME
CI_JOB_URL
If you are not using GitLab, you will need to set them manually. For instance, for GitHub actions you can check our current GitHub actions workflow.
Data Source details
The pytest-tinybird plugin creates and sends report objects via the Events API with this structure:
{
'date': now,
'commit': self.commit,
'branch': self.branch,
'job_id': self.job_id,
'job_url': self.job_url,
'job_name': self.job_name,
'test_nodeid': test.nodeid,
'test_name': test.head_line,
'test_part': test.when,
'duration': test.duration,
'outcome': test.outcome
}
There are also additional optional values that can be set for multi-repository and multi-workflow setups (e.g., in GitHub Actions):
{
'repository': self.repository
'workflow': self.workflow
}
To use these, you will need to set the CI_REPOSITORY_NAME and CI_WORKFLOW_NAME environment variables respectively.
When a report object is first sent to Tinybird, a Data Source with the following definition and schema is created:
TOKEN "pytest-executor-write" APPEND
SCHEMA >
`commit` String `json:$.commit`,
`branch` String `json:$.branch`,
`date` DateTime `json:$.date`,
`duration` Float32 `json:$.duration`,
`job_id` String `json:$.job_id`,
`job_name` String `json:$.job_name`,
`job_url` String `json:$.job_url`,
`outcome` LowCardinality(String) `json:$.outcome`,
`test_name` String `json:$.test_name`,
`test_nodeid` String `json:$.test_nodeid`,
`test_part` LowCardinality(String) `json:$.test_part`
ENGINE MergeTree
ENGINE_PARTITION_KEY toYYYYMM(date)
You can also see the Data Source schema with this data sample
from an API Endpoint created from the Data Source the pytest-tinybird plugin populates.
Metadata
Release files for pytest-tinybird 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pytest_tinybird-0.5.0.tar.gz | 6.4 kB | Without provenance | Details for pytest_tinybird-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pytest_tinybird-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for pytest_tinybird-0.5.0-py3-none-any.whl |
Total release size: 12.9 kB
Release files / pytest_tinybird-0.5.0.tar.gz
| Download URL | pytest_tinybird-0.5.0.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1438a7c4b2adf0fd5afdf0dcab958761f3fb15dac6407fbc3889ffed88539e2d
|
|
BLAKE2b-256 checksum How to use checksums |
56a340698f9937db8bb7e02c1ede1c76bb54d592f0021dbde37b37e2bec38632
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / pytest_tinybird-0.5.0-py3-none-any.whl
| Download URL | pytest_tinybird-0.5.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd41f64338320615900b2fcb1e189f60ac4dde9e18364526af16d2d2a0d05621
|
|
BLAKE2b-256 checksum How to use checksums |
40bbbebcb9e621714cfdd0984cd0ee18417260eba14c577aa0017e3853198245
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for pytest-tinybird 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.