Python collectors
To use Test Engine with your Python projects use the buildkite-test-collector package with pytest.
You can also upload test results by importing JSON or JUnit XML.
pytest collector
pytest is a testing framework for Python.
If you're already using pytest, then you can install buildkite-test-collector to collect test results into your Test Engine dashboard.
Before you start, make sure pytest runs with access to CI environment variables.
To get started with buildkite-test-collector:
In your CI environment, set the
BUILDKITE_ANALYTICS_TOKENenvironment variable securely to your Buildkite Test Engine API token.-
Add
buildkite-test-collectorto your list of dependencies. Some examples:-
If you're using a
requirements.txtfile, addbuildkite-test-collectoron a new line. -
If you're using a
setup.pyfile, addbuildkite-test-collectorto theextras_requireargument, like this:extras_require={"dev": ["pytest", "buildkite-test-collector"]} -
If you're using Pipenv, run
pipenv install --dev buildkite-test-collector.
If you're using another tool, see your dependency management system's documentation for help.
-
-
Commit and push your changes:
$ git add . $ git commit -m "Install and set up Buildkite Test Engine" $ git push
Once you're done, in your Test Engine dashboard, you'll see analytics of test executions on all branches that include this code.
If you don't see branch names, build numbers, or commit hashes in Test Engine, then read CI environments to learn more about exporting your environment to the collector.