{"id":13501479,"url":"https://github.com/reportportal/agent-python-pytest","last_synced_at":"2026-04-06T22:02:22.058Z","repository":{"id":39352264,"uuid":"86579920","full_name":"reportportal/agent-python-pytest","owner":"reportportal","description":"Framework integration with PyTest","archived":false,"fork":false,"pushed_at":"2024-06-25T09:43:07.000Z","size":4542,"stargazers_count":95,"open_issues_count":6,"forks_count":101,"subscribers_count":29,"default_branch":"develop","last_synced_at":"2024-07-18T18:33:00.836Z","etag":null,"topics":["pytest","python","reportportal"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reportportal.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-29T12:33:41.000Z","updated_at":"2024-07-18T18:33:00.837Z","dependencies_parsed_at":"2023-09-26T01:29:48.422Z","dependency_job_id":"4319af04-f6f7-4a60-9db1-7a6e1b7841b8","html_url":"https://github.com/reportportal/agent-python-pytest","commit_stats":{"total_commits":532,"total_committers":63,"mean_commits":8.444444444444445,"dds":0.4548872180451128,"last_synced_commit":"45514ffb7ce0a0a2c78edea463937298f50d3a1a"},"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reportportal%2Fagent-python-pytest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reportportal%2Fagent-python-pytest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reportportal%2Fagent-python-pytest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reportportal%2Fagent-python-pytest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reportportal","download_url":"https://codeload.github.com/reportportal/agent-python-pytest/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213424616,"owners_count":15585294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pytest","python","reportportal"],"created_at":"2024-07-31T22:01:38.906Z","updated_at":"2026-04-06T22:02:22.007Z","avatar_url":"https://github.com/reportportal.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"===================\nagent-python-pytest\n===================\n\n.. image:: https://img.shields.io/pypi/v/pytest-reportportal.svg\n    :target: https://pypi.python.org/pypi/pytest-reportportal\n    :alt: Latest Version\n.. image:: https://img.shields.io/pypi/pyversions/pytest-reportportal.svg\n    :target: https://pypi.org/project/pytest-reportportal\n    :alt: Supported python versions\n.. image:: https://github.com/reportportal/agent-python-pytest/actions/workflows/tests.yml/badge.svg\n    :target: https://github.com/reportportal/agent-python-pytest/actions/workflows/tests.yml\n    :alt: Test status\n.. image:: https://codecov.io/gh/reportportal/agent-python-pytest/branch/develop/graph/badge.svg\n    :target: https://codecov.io/gh/reportportal/agent-python-pytest\n    :alt: Test coverage\n.. image:: https://img.shields.io/badge/slack-join-brightgreen.svg\n    :target: https://slack.epmrpp.reportportal.io/\n    :alt: Join Slack chat!\n\n\nPytest plugin for reporting test results of the Pytest to the ReportPortal.\n\nInstallation\n~~~~~~~~~~~~\n\nTo install pytest plugin execute next command in a terminal:\n\n.. code-block:: bash\n\n    pip install pytest-reportportal\n\n\n\nLook through the CONTRIBUTING.rst for contribution guidelines.\n\nConfiguration\n~~~~~~~~~~~~~\n\nPrepare the config file :code:`pytest.ini` in root directory of tests or specify\nany one using pytest command line option:\n\n.. code-block:: bash\n\n    py.test -c config.cfg\n\n\nThe :code:`pytest.ini` file should have next mandatory fields:\n\n- :code:`rp_api_key` - value could be found in the User Profile section\n- :code:`rp_project` - name of project in ReportPortal\n- :code:`rp_endpoint` - address of ReportPortal Server\n\nExample of :code:`pytest.ini`:\n\n.. code-block:: text\n\n    [pytest]\n    rp_api_key = fb586627-32be-47dd-93c1-678873458a5f\n    rp_endpoint = http://192.168.1.10:8080\n    rp_project = user_personal\n    rp_launch = AnyLaunchName\n    rp_launch_attributes = 'PyTest' 'Smoke'\n    rp_launch_description = 'Smoke test'\n    rp_ignore_attributes = 'xfail' 'usefixture'\n\n- The :code:`rp_api_key` can also be set with the environment variable `RP_API_KEY`. This will override the value set for :code:`rp_api_key` in pytest.ini\n\nThere are also optional parameters:\nhttps://reportportal.io/docs/log-data-in-reportportal/test-framework-integration/Python/pytest/\n\nExamples\n~~~~~~~~\n\nFor logging of the test item flow to ReportPortal, please, use the python\nlogging handler provided by plugin like bellow:\n\nin conftest.py:\n\n.. code-block:: python\n\n    import logging\n    import sys\n\n    import pytest\n\n    from reportportal_client import RPLogger\n\n\n    @pytest.fixture(scope=\"session\")\n    def rp_logger():\n        logger = logging.getLogger(__name__)\n        logger.setLevel(logging.DEBUG)\n        logging.setLoggerClass(RPLogger)\n        return logger\n\nin tests:\n\n.. code-block:: python\n\n    # In this case only INFO messages will be sent to the ReportPortal.\n    def test_one(rp_logger):\n        rp_logger.info(\"Case1. Step1\")\n        x = \"this\"\n        rp_logger.info(\"x is: %s\", x)\n        assert 'h' in x\n\n        # Message with an attachment.\n        import subprocess\n        free_memory = subprocess.check_output(\"free -h\".split())\n        rp_logger.info(\n            \"Case1. Memory consumption\",\n            attachment={\n                \"name\": \"free_memory.txt\",\n                \"data\": free_memory,\n                \"mime\": \"application/octet-stream\",\n            },\n        )\n\n        # This debug message will not be sent to the ReportPortal.\n        rp_logger.debug(\"Case1. Debug message\")\n\nLaunching\n~~~~~~~~~\n\nTo run test with ReportPortal you must provide '--reportportal' flag:\n\n.. code-block:: bash\n\n    py.test ./tests --reportportal\n\nCheck the documentation to find more detailed information about how to integrate pytest with ReportPortal using an agent:\nhttps://reportportal.io/docs/log-data-in-reportportal/test-framework-integration/Python/pytest/\n\nCopyright Notice\n----------------\n..  Copyright Notice:  https://github.com/reportportal/agent-python-pytest#copyright-notice\n\nLicensed under the `Apache 2.0`_ license (see the LICENSE file).\n\n.. _Apache 2.0:  https://www.apache.org/licenses/LICENSE-2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freportportal%2Fagent-python-pytest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freportportal%2Fagent-python-pytest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freportportal%2Fagent-python-pytest/lists"}