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

Download files

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

Source Distribution

pytest_mergify-2026.8.5.3.tar.gz (88.3 kB view details)

Uploaded Source

Built Distributions

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

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

Uploaded CPython 3.8+Windows x86-64

pytest_mergify-2026.8.5.3-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.3-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.3-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.3-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.3-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.3-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.3.tar.gz.

File metadata

  • Download URL: pytest_mergify-2026.8.5.3.tar.gz
  • Upload date:
  • Size: 88.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pytest_mergify-2026.8.5.3.tar.gz
Algorithm Hash digest
SHA256 a26e17de5a0b9951ceedba81792c079837a7660a041a5e3f1e608d6d8b065c9e
MD5 afed3d0b1b15626c7aad70b99ff0c61f
BLAKE2b-256 93d814fb7dd662acd0f4e114656e4ca56ba862bc036606b0ce03496d8816bab8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.3.tar.gz:

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.3-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.3-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8c82e4686daaaec28e4824bba8bbd8655f8e0b4e79bb73e1f63094eff5fa1638
MD5 d8a45679432f2597c4d1a76653bbd9bb
BLAKE2b-256 2e9299fe5ceb9290e6d9948fdbe4b0f8fc37111b55689d4c48f4ca799aabb1c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.3-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.3-cp38-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.3-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 2e8cdbfe7f46eb2ca66e22468ad22ee94e64d4cb87dc28a93aa1abd742f24f3e
MD5 af091c05c2247b622bc470aadd0b0668
BLAKE2b-256 46add1990b2f84601e9943010b304faa4a29599fbd7683646cbbee54fa9d73dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.3-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.3-cp38-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.3-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 f2693f7fa5b0cd4290f9b938a8f8a108edb021c07a7b3ccadcf923cc832c1f7b
MD5 4cd19f4fd5a5c45d59646b245bb2a882
BLAKE2b-256 ddd1e856c58226a413b35b6e96ce4477538f8731337527848925001575cc20bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.3-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.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3577fefd5838e8fca5a51091efb6c06b384a4b0c2f23aef32173177316023700
MD5 de32e5c01c30ae5367e89d5400744faf
BLAKE2b-256 a85ab935b78f27911d0cc518a2bbb73e55c393b1ba93c8b309fc1f3ec3e59ad7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.3-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.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b8940c01eaed55d045c98dbb4c3de702075831e9d4a21c0b097ef1c56a0c9129
MD5 c52d20163cae794dd4086336bfc91af6
BLAKE2b-256 11b0a9eb9bd445dc025c986370f53aa94ab3f645e0f9e31bdea757fd4c511012

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.3-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.3-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.3-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 07858061f8f1e2a2eb24c4d262db3644ded209f5eb27614fdfde178b416d3b91
MD5 dcaf50bb1276801f1add1c226ecb34f4
BLAKE2b-256 46307b718f27036afcf9c80bafa22b68382025b9caf037052c86398009cf37dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.3-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.3-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.3-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a141e1a99319f83bc2fcb3c2fb0fb76ff2d24ebe9bf01ec66c228b7c5ad4b189
MD5 e87478da80363413f3413ed3adfbf44d
BLAKE2b-256 8663555be8a2292d4423104d3c524a4875b11d1cd555a68c5a1c9d2d1a3f4b2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.3-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