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

GPL-3.0-only

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pytest_mergify-2026.8.5.1-cp38-abi3-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.8+Windows x86-64

pytest_mergify-2026.8.5.1-cp38-abi3-musllinux_1_2_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ x86-64

pytest_mergify-2026.8.5.1-cp38-abi3-musllinux_1_2_aarch64.whl (2.4 MB view details)

Uploaded CPython 3.8+musllinux: musl 1.2+ ARM64

pytest_mergify-2026.8.5.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.3 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

pytest_mergify-2026.8.5.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.2 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

pytest_mergify-2026.8.5.1-cp38-abi3-macosx_11_0_arm64.whl (2.1 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

pytest_mergify-2026.8.5.1-cp38-abi3-macosx_10_12_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file pytest_mergify-2026.8.5.1-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.1-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d3aa2d7deece9427d15e28f830414a33e63059b4a164dce38f05ca88bcfe16db
MD5 a52283c5e51723c6ff6e174fb8531530
BLAKE2b-256 949605086426d15cd3621ac497f425af0defe61f8a4c71431faafb6554b5a946

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.1-cp38-abi3-win_amd64.whl:

Publisher: release-pytest-mergify.yml on Mergifyio/mergify-ci-integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_mergify-2026.8.5.1-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.1-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7e552c6efc388d78aac30dec8a68a05353a111762ba88a431c12bf7114d68232
MD5 68a15bd5651318325a2c69a8bd05fefb
BLAKE2b-256 025b4b55e777582586d898291aea787c45553ffb8b39900dad37fd26fa539c90

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.1-cp38-abi3-musllinux_1_2_x86_64.whl:

Publisher: release-pytest-mergify.yml on Mergifyio/mergify-ci-integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_mergify-2026.8.5.1-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.1-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 7122a7af3ca7c7539329aceb46287eced32cf1be32f0ea7ba287bd5ef1271433
MD5 a8af0adedd5b3b0c9a65fc2fc879abec
BLAKE2b-256 fa78cb473a8b84544d10cc01cb5864ac290663d85212171fe5f705585b628051

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.1-cp38-abi3-musllinux_1_2_aarch64.whl:

Publisher: release-pytest-mergify.yml on Mergifyio/mergify-ci-integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_mergify-2026.8.5.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0a5e1da2a1d7dc28c77bc566fc5279f2d3b41887aa0c55aafa463895b1627d1e
MD5 143820b4aea433434ae1ee8bacdee63d
BLAKE2b-256 d43bf1b8bd6f68ff51fa8cdd93a6a6bcdd321385a009ba09f80ce602134ef987

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pytest-mergify.yml on Mergifyio/mergify-ci-integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_mergify-2026.8.5.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6bf410a0fd5c652a8c8da0f6d862900b7779b410ddbb35ae2abee4e45852f26c
MD5 62a236ee049b4f3ffe7d10a6e7e04172
BLAKE2b-256 8f48f7811fc3b51f1c525b5a0831bee322c77ac0b53092e27f01ca15a1b957da

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-pytest-mergify.yml on Mergifyio/mergify-ci-integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_mergify-2026.8.5.1-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.1-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ebf2f5b64631ebf47e062cc7318be408a2e453c38c27d837cca5f168a040bf1b
MD5 c8fe5c7a18e9fe9806ac8b0626aac4e4
BLAKE2b-256 8997c24f4207270f5ec63cdafb5fb9ccfcf86a36adc3d684178e7afc4cd4278a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.1-cp38-abi3-macosx_11_0_arm64.whl:

Publisher: release-pytest-mergify.yml on Mergifyio/mergify-ci-integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_mergify-2026.8.5.1-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.1-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d683dcd335ec70b854367cd8f419309f99a5bcbe5a86ba705fa5f3c614c1e7d9
MD5 89021f5cdc79e3017d76dee87e1159f0
BLAKE2b-256 c47bc699fe5438b278a4b841c8be4f4f528e227531ef9339d543040d4ecceb90

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.1-cp38-abi3-macosx_10_12_x86_64.whl:

Publisher: release-pytest-mergify.yml on Mergifyio/mergify-ci-integrations

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page