Buildkite Test Collector for Python

1.4.1 · active · verified Sun Apr 12

The `buildkite-test-collector` is the official Python adapter for Buildkite Test Engine, designed to collect and report test results, primarily from `pytest` suites, to the Buildkite Test Engine dashboard. It integrates seamlessly with CI environments and is actively maintained with frequent updates.

Warnings

Install

Imports

Quickstart

To quickly start collecting test data, first install the library and pytest. Then, set the `BUILDKITE_ANALYTICS_TOKEN` environment variable with your Buildkite Test Engine API token and run your pytest suite as usual. The collector will automatically send test results to Buildkite. For local testing, ensure `BUILDKITE_ANALYTICS_TOKEN` is set, or mock it.

import os

# test_example.py
def test_passing_example():
    assert True

def test_failing_example():
    assert False

# To run:
# 1. Set the Buildkite Analytics Token:
#    export BUILDKITE_ANALYTICS_TOKEN='your-api-token'
# 2. Run pytest:
#    pytest
# You can use os.environ.get('BUILDKITE_ANALYTICS_TOKEN', '') for local testing
# but in CI, it must be properly set as an environment variable.

view raw JSON →