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.2.tar.gz (87.2 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.2-cp38-abi3-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.8+Windows x86-64

pytest_mergify-2026.8.5.2-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.2-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.2-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.2-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.2-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.2-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.2.tar.gz.

File metadata

  • Download URL: pytest_mergify-2026.8.5.2.tar.gz
  • Upload date:
  • Size: 87.2 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.2.tar.gz
Algorithm Hash digest
SHA256 8b99c5b3dd99e107d05739f1ce61c8c251149d7adf741b60f795546dcf3da807
MD5 89b0d14231f0f9ccd2cffcb3c41c43d7
BLAKE2b-256 7a44fff7a433f53e056294ba6e7e66e5c26691c7abdc08b151165274a825df0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_mergify-2026.8.5.2.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.2-cp38-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b39d6c44dab10799e2c81aa7ad4fe1046f9413b0496ad4fdd7739f641f3e65fe
MD5 0ead344d5e61650fa727589c12e8495d
BLAKE2b-256 5819b5012700265a8cdb1ac55ddcb23a37963ac421fac4721e668e7233bfa6e8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.2-cp38-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e81821ace97443cd44d3804fb4bab363dbdbe48b8134796eecc9ce94fa0ae92a
MD5 47a394fd4029847945ac8b6fc6dfc69c
BLAKE2b-256 087731bd06d3bc6bcfb344ae8bc6a7f47499eeb7ff9d710524d5f999525e7492

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.2-cp38-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 8ef933507feff32c2d5905172f8fa93c7efd7a1d7780e299a245259cb2c2adf3
MD5 ad3aedf3498033c80422ad178bcc1a05
BLAKE2b-256 84b15fbbde8f844b923f24ddeb1db0d0e676dde1ddda8ef9029e075aafaa1f26

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6ef1a6d81eeba13a9385f3d7722b615275c09fa43b6f9c7c8729d9ef0bf1eece
MD5 75246a418a040bcb20cc46c41f21c8dd
BLAKE2b-256 891891b885911272c2efa75f37f4f346c61b5fcd060576f80d5f4f2d52d9ac3b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 0368506731bda5824044bf42af8a6d87e18edb51e4b1d9169d422774d9fd99e0
MD5 707eff014a27521cc6bf0f170149c291
BLAKE2b-256 421cc3afbc86187e70d9497e1c44a3ca56386cbbe759b9b6ef96a17dfd8da9b3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e2a3682c277b7d8d3a448908904542244cb470de2ef3f2a3a9904874b4977f1c
MD5 fa35f444b7062f2b17f02738a0e7e516
BLAKE2b-256 ffc2dcd1d35a7844e84900ecd2cb3918c2521583a0f35a597487ae42f235904c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pytest_mergify-2026.8.5.2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4f2cdf3419766b635e71eaca2e64e86d463eba8b1ebfbf26e082c40b400c575d
MD5 a42de8baa2c85f82ba27317522146457
BLAKE2b-256 eaa0e18c13186f5256a715344cae05f32ee21eb86755ed134f5b152544ec51a0

See more details on using hashes here.

Provenance

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