Skip to main content

pytest-mergify

Pytest plugin for Mergify Test Insights.

More information at https://mergify.com

Features

  • Test tracing — Sends OpenTelemetry traces for every test to Mergify's API
  • Flaky test detection — Intelligently reruns tests to detect flakiness with budget constraints
  • Test quarantine — Quarantines failing tests so they don't block CI
  • Test selection — Runs only the previously-failing tests when Mergify's merge queue reruns a job

Installation

Install the package alongside pytest (>= 6.0.0):

pip install pytest-mergify

The plugin is auto-discovered by pytest — no manual registration required.

Configuration

Set the MERGIFY_TOKEN environment variable with your Mergify API token.

The plugin activates automatically when running in CI (detected via the CI environment variable). To enable outside CI, set PYTEST_MERGIFY_ENABLE=true.

Environment Variables

Variable Description Default
MERGIFY_TOKEN Mergify API authentication token (required)
MERGIFY_API_URL Mergify API endpoint https://api.mergify.com
PYTEST_MERGIFY_ENABLE Force-enable outside CI false
PYTEST_MERGIFY_DEBUG Print spans to console false
MERGIFY_TRACEPARENT W3C distributed trace context —
MERGIFY_TEST_JOB_NAME Mergify test job name —
MERGIFY_TEST_SELECTION_DISABLE Opt out of test selection (see below) false

For detailed documentation, see the official guide.

Test selection

When Mergify's merge queue reruns a job — a retry, or a step of a batch bisection — only the tests that failed on the previous attempt are informative. The plugin asks Mergify whether the current run is such a rerun and, if so, runs only those tests; the rest are reported as deselected.

Nothing to configure: the plugin uses the token and job identity it already has, and Mergify decides. Any other situation — a normal run, a rerun Mergify has no previous results for, an unreachable API — runs the full suite, so the feature can only remove work, never coverage. The feature is also enabled per organization on Mergify's side, so it stays inactive until your organization is opted in.

Set MERGIFY_TEST_SELECTION_DISABLE=true in your CI to opt out: the plugin then always runs the full suite and never queries the endpoint. It is scoped to this feature only — test tracing, flaky detection and quarantine keep working (unset MERGIFY_TOKEN to turn the plugin off entirely).

Development

Prerequisites

  • Python >= 3.8
  • uv

Setup

uv sync

Running Tests

uv run poe test

Linting

uv run poe linters

License

Apache-2.0

Metadata

Release files for pytest-mergify 2026.9.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-mergify 2026.9.1.1
File Size Uploaded
pytest_mergify-2026.9.1.1.tar.gz 104.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pytest-mergify 2026.9.1.1
File
pytest_mergify-2026.9.1.1-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
pytest_mergify-2026.9.1.1-cp38-abi3-musllinux_1_2_x86_64.whl CPython 3.8 abi3 Linux musl 1.2+ x86-64 Details
pytest_mergify-2026.9.1.1-cp38-abi3-musllinux_1_2_aarch64.whl CPython 3.8 abi3 Linux musl 1.2+ ARM64 Details
pytest_mergify-2026.9.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
pytest_mergify-2026.9.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details
pytest_mergify-2026.9.1.1-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
pytest_mergify-2026.9.1.1-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details

Total release size: 16.4 MB

Release files / pytest_mergify-2026.9.1.1.tar.gz

Download URL pytest_mergify-2026.9.1.1.tar.gz
Size 104.7 kB
Tags Source
SHA-256 checksum
How to use checksums
46c3b69194d8f1c2df3e558c62f367a51c17a2a6da34f5322b9e3188037cb3b6
BLAKE2b-256 checksum
How to use checksums
92fa1552fa15540cba0b21971417e2f3ba2aa2b09affcfa75aa327e958cefa9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / pytest_mergify-2026.9.1.1-cp38-abi3-win_amd64.whl

Download URL pytest_mergify-2026.9.1.1-cp38-abi3-win_amd64.whl
Size 2.3 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
17120f5a2e56b0aac6bbdc81e0df2697ffe448c58cb1818c2929f27eb937eb4d
BLAKE2b-256 checksum
How to use checksums
804367e8ee74d125023555482215f2dc3b743e76b7d0e6610f342c163bdffa5f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / pytest_mergify-2026.9.1.1-cp38-abi3-musllinux_1_2_x86_64.whl

Download URL pytest_mergify-2026.9.1.1-cp38-abi3-musllinux_1_2_x86_64.whl
Size 2.6 MB
Tags CPython 3.8 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
f2ab555899f8790e99dfe9236e11b49544f3a9ad5eefd1c06592a66ce3ba34e5
BLAKE2b-256 checksum
How to use checksums
981eab28c6535140a495dbc963af4546da51138b76b8662d0869481bf6391522
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / pytest_mergify-2026.9.1.1-cp38-abi3-musllinux_1_2_aarch64.whl

Download URL pytest_mergify-2026.9.1.1-cp38-abi3-musllinux_1_2_aarch64.whl
Size 2.4 MB
Tags CPython 3.8 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
5675771824da1da008cc92d599fb83fc3fffb7099da53754a23d0a6c22ce5732
BLAKE2b-256 checksum
How to use checksums
00208dd10720f9d0621e3d648665cde9e06bd7b7f5e8e4923533b37d48a80308
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / pytest_mergify-2026.9.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pytest_mergify-2026.9.1.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.3 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
2935b4d43ac3096edc9646a96d9c9e36f09688534511c63265a60ced1d8da1b9
BLAKE2b-256 checksum
How to use checksums
e330faddbc45bca687e9a4b83ad41fcb3979f120c7fb3f425795eab871c66e05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / pytest_mergify-2026.9.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL pytest_mergify-2026.9.1.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 2.2 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
a1970364ebc07322fca2c577964e0ff822b74c2688d08e1c618efcd57eefa5d5
BLAKE2b-256 checksum
How to use checksums
7c086575729732123c7a18010ec838e9094c9c2ad9098d54c203ce9d47fc3025
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / pytest_mergify-2026.9.1.1-cp38-abi3-macosx_11_0_arm64.whl

Download URL pytest_mergify-2026.9.1.1-cp38-abi3-macosx_11_0_arm64.whl
Size 2.1 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0ab7d0b563857e363573475db80f72eb413cc926a1934d4067b45f2dc977af11
BLAKE2b-256 checksum
How to use checksums
13dfc394c1720dcb32255f74e6de1341e90d0b8a941448ea45acb150ea7ba24e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release files / pytest_mergify-2026.9.1.1-cp38-abi3-macosx_10_12_x86_64.whl

Download URL pytest_mergify-2026.9.1.1-cp38-abi3-macosx_10_12_x86_64.whl
Size 2.2 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5ccbfea2e37c0dc3c75e71809f16e9a1fcbe8d3d9345937af31b7ded10461d39
BLAKE2b-256 checksum
How to use checksums
750cd64fd22992cd3897848a0b070588109be859b2da7d08eb8748bd04303747
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2026.9.1.1 This release

8 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page