
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Pytest plugin for reporting test results of the Pytest to the ReportPortal.
DISCLAIMER: We use Google Analytics for sending anonymous usage information such as agent's and client's names, and their versions after a successful launch start. This information might help us to improve both ReportPortal backend and client sides. It is used by the ReportPortal team only and is not supposed for sharing with 3rd parties.
To install pytest plugin execute next command in a terminal:
pip install pytest-reportportal
Look through the CONTRIBUTING.rst
for contribution guidelines.
Prepare the config file pytest.ini
in root directory of tests or specify any one using pytest command line option:
py.test -c config.cfg
The pytest.ini
file should have next mandatory fields:
rp_api_key
- value could be found in the User Profile sectionrp_project
- name of project in ReportPortalrp_endpoint
- address of ReportPortal ServerExample of pytest.ini
:
[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'
rp_api_key
can also be set with the environment variable RP_API_KEY
. This will override the value set for rp_api_key
in pytest.iniThere are also optional parameters: https://reportportal.io/docs/log-data-in-reportportal/test-framework-integration/Python/pytest/
For logging of the test item flow to ReportPortal, please, use the python logging handler provided by plugin like below:
in conftest.py
:
import logging
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:
# 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")
To run test with ReportPortal you must provide --reportportal
flag:
py.test ./tests --reportportal
Check the documentation to find more detailed information about how to integrate pytest with ReportPortal using the agent: https://reportportal.io/docs/log-data-in-reportportal/test-framework-integration/Python/pytest/
Licensed under the Apache 2.0 license (see the LICENSE file).
FAQs
Agent for Reporting results of tests to the Report Portal
We found that pytest-reportportal demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.