{"id":21814,"library":"pytest-testrail","title":"pytest-testrail","description":"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.","status":"active","version":"3.1.1","language":"python","source_language":"en","source_url":"https://github.com/allankp/pytest-testrail","tags":["pytest","testrail","test-reporting","plugin","testing"],"install":[{"cmd":"pip install pytest-testrail","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core plugin dependency as a pytest plugin.","package":"pytest","optional":false},{"reason":"Used for communicating with TestRail API.","package":"requests","optional":false}],"imports":[{"note":"The plugin is typically auto-loaded by pytest; explicit import not required.","wrong":"from pytest_testrail import *","symbol":"pytest_testrail","correct":"import pytest_testrail"},{"note":"get_testrail_client moved to fixtures in v3.x.","wrong":"from pytest_testrail import get_testrail_client","symbol":"pytest_testrail.fixtures","correct":"from pytest_testrail.fixtures import get_testrail_client"}],"quickstart":{"code":"# conftest.py or test file\nimport os\nimport pytest\n\n# Enable plugin via pytest.ini or pyproject.toml\n# [pytest]\n# testrail = \n#   url = https://your.testrail.com\n#   user = your_email\n#   password = your_password_or_api_key\n#   project_id = 1\n#   suite_id = 1\n#   run_name = Automated Run\n\n# Test case must have testrail id marker\n@pytest.mark.testrail(id='C123')\ndef test_example():\n    assert 1 + 1 == 2\n\n# Or use dynamic assignment\nfrom pytest_testrail.plugin import TestRail\n\n# Optionally get client\nfrom pytest_testrail.fixtures import get_testrail_client\n\ndef test_custom(client=get_testrail_client()):\n    # Use client directly if needed\n    assert client\n    assert True","lang":"python","description":"Minimal setup: add marker @pytest.mark.testrail(id='C123') to tests, configure pytest.ini with TestRail credentials, and run pytest."},"warnings":[{"fix":"Update pytest.ini: replace [testrail] with [pytest] testrail block or use pytest options.","message":"In v2.x, the plugin used a different configuration format. v3.x changed the config section name and flattened options. Check existing pytest.ini files.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use @pytest.mark.testrail(id='C123') instead of @pytest.mark.testrail.","message":"The 'testrail' marker without an explicit id may be deprecated in future; always use id parameter.","severity":"deprecated","affected_versions":"all"},{"fix":"Verify TestRail URL and credentials; use pytest with -s to see debug output.","message":"The plugin requires a running TestRail instance; it will fail if the URL is unreachable. Network timeout issues are common.","severity":"gotcha","affected_versions":"all"},{"fix":"In config, set password = your_api_key (not your login password).","message":"If using API key, set password field to the API key; some users mistakenly use a password instead.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install pytest-testrail: pip install pytest-testrail. Ensure it is in the current environment.","cause":"The plugin is not installed or not activated.","error":"pytest: error: unrecognized arguments: --testrail"},{"fix":"Run: pip install pytest-testrail. Check that you are in the correct virtual environment.","cause":"pytest-testrail is not installed or virtual environment not activated.","error":"ModuleNotFoundError: No module named 'pytest_testrail'"},{"fix":"Use: from pytest_testrail.fixtures import get_testrail_client","cause":"Incorrect import path. get_testrail_client is in the fixtures submodule.","error":"AttributeError: module 'pytest_testrail' has no attribute 'get_testrail_client'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}