Registry / testing / pytest-testrail

pytest-testrail

JSON →
library3.1.1pypypi✓ verified 84d ago

A pytest plugin for creating TestRail test runs and adding results automatically. Version 3.1.1 requires Python >=3.10, released under MIT License. Active development with frequent releases.

pip install pytest-testrail
INSTALL
IMPORT
SIG · PYTEST-TESTRAIL
P
pytest-testrail
testingpythonv3.1.1
Install
3.3s avg
Import
880ms
Disk
33MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.1.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.738s · 34MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.3s · import 0.670s · 34MB
33MB installed
● package 33MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pytest_testrail
import pytest_testrail
from pytest_testrail import *
The plugin is typically auto-loaded by pytest; explicit import not required.
pytest_testrail.fixtures
from pytest_testrail.fixtures import get_testrail_client
from pytest_testrail import get_testrail_client
get_testrail_client moved to fixtures in v3.x.

Minimal setup: add marker @pytest.mark.testrail(id='C123') to tests, configure pytest.ini with TestRail credentials, and run pytest.

# conftest.py or test file import os import pytest # Enable plugin via pytest.ini or pyproject.toml # [pytest] # testrail = # url = https://your.testrail.com # user = your_email # password = your_password_or_api_key # project_id = 1 # suite_id = 1 # run_name = Automated Run # Test case must have testrail id marker @pytest.mark.testrail(id='C123') def test_example(): assert 1 + 1 == 2 # Or use dynamic assignment from pytest_testrail.plugin import TestRail # Optionally get client from pytest_testrail.fixtures import get_testrail_client def test_custom(client=get_testrail_client()): # Use client directly if needed assert client assert True
Debug
Known issues
breakingIn v2.x, the plugin used a different configuration format. v3.x changed the config section name and flattened options. Check existing pytest.ini files.
fix
Update pytest.ini: replace [testrail] with [pytest] testrail block or use pytest options.
affects: >=3.0.0
deprecatedThe 'testrail' marker without an explicit id may be deprecated in future; always use id parameter.
fix
Use @pytest.mark.testrail(id='C123') instead of @pytest.mark.testrail.
affects: all
gotchaThe plugin requires a running TestRail instance; it will fail if the URL is unreachable. Network timeout issues are common.
fix
Verify TestRail URL and credentials; use pytest with -s to see debug output.
affects: all
gotchaIf using API key, set password field to the API key; some users mistakenly use a password instead.
fix
In config, set password = your_api_key (not your login password).
affects: all
Errors
Common errors & fixes
pytest: error: unrecognized arguments: --testrail
The plugin is not installed or not activated.
fix
Install pytest-testrail: pip install pytest-testrail. Ensure it is in the current environment.
ModuleNotFoundError: No module named 'pytest_testrail'
pytest-testrail is not installed or virtual environment not activated.
fix
Run: pip install pytest-testrail. Check that you are in the correct virtual environment.
AttributeError: module 'pytest_testrail' has no attribute 'get_testrail_client'
Incorrect import path. get_testrail_client is in the fixtures submodule.
fix
Use: from pytest_testrail.fixtures import get_testrail_client
Upgrade
Version history
3.1.1latest on PyPI · released Jan 25, 2026
Audit
Dependencies
pytestrequiredCore plugin dependency as a pytest plugin.
requestsrequiredUsed for communicating with TestRail API.
Agent activity
38 hits · last 30 days
node
32
OpenAI (training)
1
Resources
pytest-testrail — pip install pytest-testrail · libregistry