pytest-reportportal


Namepytest-reportportal JSON
Version 5.4.1 PyPI version JSON
download
home_pagehttps://github.com/reportportal/agent-python-pytest
SummaryAgent for Reporting results of tests to the Report Portal
upload_time2024-03-27 09:39:43
maintainerNone
docs_urlNone
authorReport Portal Team
requires_pythonNone
licenseApache 2.0
keywords testing reporting reportportal pytest agent
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ===================
agent-python-pytest
===================

.. image:: https://img.shields.io/pypi/v/pytest-reportportal.svg
    :target: https://pypi.python.org/pypi/pytest-reportportal
    :alt: Latest Version
.. image:: https://img.shields.io/pypi/pyversions/pytest-reportportal.svg
    :target: https://pypi.org/project/pytest-reportportal
    :alt: Supported python versions
.. image:: https://github.com/reportportal/agent-python-pytest/actions/workflows/tests.yml/badge.svg
    :target: https://github.com/reportportal/agent-python-pytest/actions/workflows/tests.yml
    :alt: Test status
.. image:: https://codecov.io/gh/reportportal/agent-python-pytest/branch/develop/graph/badge.svg
    :target: https://codecov.io/gh/reportportal/agent-python-pytest
    :alt: Test coverage
.. image:: https://img.shields.io/badge/slack-join-brightgreen.svg
    :target: https://slack.epmrpp.reportportal.io/
    :alt: Join Slack chat!


Pytest plugin for reporting test results of the Pytest to the ReportPortal.

Installation
~~~~~~~~~~~~

To install pytest plugin execute next command in a terminal:

.. code-block:: bash

    pip install pytest-reportportal



Look through the CONTRIBUTING.rst for contribution guidelines.

Configuration
~~~~~~~~~~~~~

Prepare the config file :code:`pytest.ini` in root directory of tests or specify
any one using pytest command line option:

.. code-block:: bash

    py.test -c config.cfg


The :code:`pytest.ini` file should have next mandatory fields:

- :code:`rp_api_key` - value could be found in the User Profile section
- :code:`rp_project` - name of project in ReportPortal
- :code:`rp_endpoint` - address of ReportPortal Server

Example of :code:`pytest.ini`:

.. code-block:: text

    [pytest]
    rp_api_key = fb586627-32be-47dd-93c1-678873458a5f
    rp_endpoint = http://192.168.1.10:8080
    rp_project = user_personal
    rp_launch = AnyLaunchName
    rp_launch_attributes = 'PyTest' 'Smoke'
    rp_launch_description = 'Smoke test'
    rp_ignore_attributes = 'xfail' 'usefixture'

- 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

There are also optional parameters:
https://reportportal.io/docs/log-data-in-reportportal/test-framework-integration/Python/pytest/

Examples
~~~~~~~~

For logging of the test item flow to ReportPortal, please, use the python
logging handler provided by plugin like bellow:

in conftest.py:

.. code-block:: python

    import logging
    import sys

    import pytest

    from reportportal_client import RPLogger


    @pytest.fixture(scope="session")
    def rp_logger():
        logger = logging.getLogger(__name__)
        logger.setLevel(logging.DEBUG)
        logging.setLoggerClass(RPLogger)
        return logger

in tests:

.. code-block:: python

    # In this case only INFO messages will be sent to the ReportPortal.
    def test_one(rp_logger):
        rp_logger.info("Case1. Step1")
        x = "this"
        rp_logger.info("x is: %s", x)
        assert 'h' in x

        # Message with an attachment.
        import subprocess
        free_memory = subprocess.check_output("free -h".split())
        rp_logger.info(
            "Case1. Memory consumption",
            attachment={
                "name": "free_memory.txt",
                "data": free_memory,
                "mime": "application/octet-stream",
            },
        )

        # This debug message will not be sent to the ReportPortal.
        rp_logger.debug("Case1. Debug message")

Launching
~~~~~~~~~

To run test with ReportPortal you must provide '--reportportal' flag:

.. code-block:: bash

    py.test ./tests --reportportal

Check the documentation to find more detailed information about how to integrate pytest with ReportPortal using an agent:
https://reportportal.io/docs/log-data-in-reportportal/test-framework-integration/Python/pytest/

Copyright Notice
----------------
..  Copyright Notice:  https://github.com/reportportal/agent-python-pytest#copyright-notice

Licensed under the `Apache 2.0`_ license (see the LICENSE file).

.. _Apache 2.0:  https://www.apache.org/licenses/LICENSE-2.0

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/reportportal/agent-python-pytest",
    "name": "pytest-reportportal",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "testing, reporting, reportportal, pytest, agent",
    "author": "Report Portal Team",
    "author_email": "support@reportportal.io",
    "download_url": "https://files.pythonhosted.org/packages/8a/66/c5923846880519ee2bc912371c5c0ccb686f410f33ee92926f09fa9d6384/pytest-reportportal-5.4.1.tar.gz",
    "platform": null,
    "description": "===================\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",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Agent for Reporting results of tests to the Report Portal",
    "version": "5.4.1",
    "project_urls": {
        "Homepage": "https://github.com/reportportal/agent-python-pytest"
    },
    "split_keywords": [
        "testing",
        " reporting",
        " reportportal",
        " pytest",
        " agent"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "65c6f2f6bb56cb5562a95e0ed4b84a882e587d739990a6f8a2816533cca7f126",
                "md5": "7675ded513891d54986c51226ca232fc",
                "sha256": "77503398d19044e62faa392792b92944e8846b40d0983d6b82e02eb52cafa512"
            },
            "downloads": -1,
            "filename": "pytest_reportportal-5.4.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7675ded513891d54986c51226ca232fc",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 27210,
            "upload_time": "2024-03-27T09:39:41",
            "upload_time_iso_8601": "2024-03-27T09:39:41.844345Z",
            "url": "https://files.pythonhosted.org/packages/65/c6/f2f6bb56cb5562a95e0ed4b84a882e587d739990a6f8a2816533cca7f126/pytest_reportportal-5.4.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8a66c5923846880519ee2bc912371c5c0ccb686f410f33ee92926f09fa9d6384",
                "md5": "1cc87449c3b32b060e0963cd81b229d5",
                "sha256": "5af38667cb922695a0c73fdab472cdc75a9d9be255b51053b354d8f1a5a49d33"
            },
            "downloads": -1,
            "filename": "pytest-reportportal-5.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1cc87449c3b32b060e0963cd81b229d5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 26662,
            "upload_time": "2024-03-27T09:39:43",
            "upload_time_iso_8601": "2024-03-27T09:39:43.579457Z",
            "url": "https://files.pythonhosted.org/packages/8a/66/c5923846880519ee2bc912371c5c0ccb686f410f33ee92926f09fa9d6384/pytest-reportportal-5.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-27 09:39:43",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "reportportal",
    "github_project": "agent-python-pytest",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "pytest-reportportal"
}
        
Elapsed time: 0.23811s