===================
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/5e/c4/7ef7082887ab45dc08b9fab9bd2a7e972b34ff773b9f6bfbe3bf4ccee681/pytest_reportportal-5.4.7.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.7",
"project_urls": {
"Homepage": "https://github.com/reportportal/agent-python-pytest"
},
"split_keywords": [
"testing",
" reporting",
" reportportal",
" pytest",
" agent"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bb078e0ff9ff06c3bd0f1bf9e316faef04f69ce2b03796364f21b54ffa48b80a",
"md5": "c6d82e4467ac38daa8a588dabcf902dd",
"sha256": "9ac17a19e39a3839b0b0ffb3d75bd2f309aa906456ca1368693aa9c2820e713a"
},
"downloads": -1,
"filename": "pytest_reportportal-5.4.7-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "c6d82e4467ac38daa8a588dabcf902dd",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 27454,
"upload_time": "2024-12-04T09:43:29",
"upload_time_iso_8601": "2024-12-04T09:43:29.052770Z",
"url": "https://files.pythonhosted.org/packages/bb/07/8e0ff9ff06c3bd0f1bf9e316faef04f69ce2b03796364f21b54ffa48b80a/pytest_reportportal-5.4.7-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5ec47ef7082887ab45dc08b9fab9bd2a7e972b34ff773b9f6bfbe3bf4ccee681",
"md5": "f555851eff35d554e1f020d0b886ef68",
"sha256": "0bda05ef674d934ac423d62c5c494970b68de1a0cfc13453a6e2efe4c9bd9ef8"
},
"downloads": -1,
"filename": "pytest_reportportal-5.4.7.tar.gz",
"has_sig": false,
"md5_digest": "f555851eff35d554e1f020d0b886ef68",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 27537,
"upload_time": "2024-12-04T09:43:30",
"upload_time_iso_8601": "2024-12-04T09:43:30.085030Z",
"url": "https://files.pythonhosted.org/packages/5e/c4/7ef7082887ab45dc08b9fab9bd2a7e972b34ff773b9f6bfbe3bf4ccee681/pytest_reportportal-5.4.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-04 09:43:30",
"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": [
{
"name": "dill",
"specs": [
[
">=",
"0.3.6"
]
]
},
{
"name": "pytest",
"specs": [
[
">=",
"3.8.0"
]
]
},
{
"name": "reportportal-client",
"specs": [
[
"~=",
"5.5.10"
]
]
},
{
"name": "aenum",
"specs": [
[
">=",
"3.1.0"
]
]
}
],
"tox": true,
"lcname": "pytest-reportportal"
}