pytest-testrail
A pytest plugin for creating TestRail runs and adding results
What it is and what it does
pytest-testrail is a pytest plugin that bridges test execution and TestRail test management. It reads pytest markers to identify which tests should be added to a TestRail test run, executes them, and automatically pushes results back to TestRail. The plugin handles test run creation, result updates, and defect tracking integration.
Version 3.1.1 is a modernized release requiring Python 3.10+, with full type hints, API key authentication (recommended over passwords), connection pooling via requests, automatic retry on rate limiting, and proper exception handling. It depends on pytest and requests, and supports TestRail API pagination for TestRail 6.7+. Configuration is done via INI file or command-line options, and the plugin can be used both as a pytest plugin or as a standalone APIClient for programmatic access.
Use it for:
- Automatically create and populate TestRail test runs from pytest test suites marked with @pytestrail.case decorators.
- Push test results back to TestRail after pytest execution, keeping test management synchronized with CI/CD pipelines.
- Link test failures to defects in Jira or other tracking systems using @pytestrail.defect markers.
- Query TestRail data programmatically via the APIClient for custom reporting or test orchestration.
- Handle paginated TestRail API responses when working with large test case inventories.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that integrates test execution with TestRail, automatically creating test runs and updating results in TestRail based on pytest markers.
Yes, if you use TestRail and pytest together. The plugin has low install friction, permissive licensing, no known vulnerabilities, and is actively maintained (last commit January 2026). The aging maintenance status (201 days since last release) is not a blocker for stable integrations, but verify that your TestRail version and API requirements align before deploying to production.
Install
pytest-testrail on PyPI
pip
pip install pytest-testrailuv
uv add pytest-testrailpoetry
poetry add pytest-testrailInstalling pytest-testrail
Before you install
Low install friction with a pure-Python wheel. Maintenance status is aging—last release was 201 days ago—but the repository remains active and not archived, with recent commits as of 2026-01-25.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution for commercial or private projects.
Quickstart
pip install pytest-testrail
from pytest_testrail.plugin import pytestrail
@pytestrail.case('C1234')
def test_example():
pass
# Run with: pytest --testrail --tr-config=testrail.cfg
Requires Python 3.10 or later; TestRail server credentials (URL, email/API key, project/suite IDs) must be configured via config file or command-line options.
Verify before relying
- Whether automatic retry on rate limiting (HTTP 429) is fully tested under production load.
- Compatibility with TestRail versions older than 6.7 (pagination support requires 6.7+).
- Performance characteristics when handling large test suites with connection pooling.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pytest, requests |
| Maintenance | aging — 201 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 123,329/month — #11,913 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_testrail-3.1.1-py3-none-any.whl
Keywords: pytest, qa, test-management, testing, testrail
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
pytest-pytestrailA pytest plugin that decorates test functions…
permissive · top 15,000 on PyPI
testrail-apiA Python wrapper for the TestRail API that lets…
permissive · top 5,000 on PyPI
trcliA command-line tool for uploading test…
unclear · top 15,000 on PyPI
pytest-orderingA pytest plugin that lets you control the…
permissive · top 5,000 on PyPI
pytest-seleniumpytest-selenium is a pytest plugin that…
copyleft · top 15,000 on PyPI
pytest-timeoutAborts pytest tests that exceed a specified…
permissive · top 1,000 on PyPI
syrupySyrupy is a pytest plugin that enables snapshot…
permissive · top 5,000 on PyPI
pytest-integrationA pytest plugin that organizes tests into unit,…
permissive · top 15,000 on PyPI
pytest-ruffA pytest plugin that integrates ruff code…
unclear · top 15,000 on PyPI
pytest-timeoutsA pytest plugin that enforces separate timeout…
permissive · top 5,000 on PyPI