Skip to content

Commit 3806e10

Browse files
authored
Merge pull request #391 from reportportal/develop
Release
2 parents aa16f98 + db10812 commit 3806e10

File tree

124 files changed

+4411
-1637
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+4411
-1637
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919
paths-ignore:
2020
- '.github/**'
2121
- CHANGELOG.md
22-
- README.rst
22+
- README.md
2323
- CONTRIBUTING.rst
2424

2525
env:
@@ -41,7 +41,7 @@ jobs:
4141
- name: Set up Python
4242
uses: actions/setup-python@v5
4343
with:
44-
python-version: '3.8'
44+
python-version: '3.10'
4545

4646
- name: Install dependencies
4747
run: python -m pip install --upgrade pip setuptools wheel

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
runs-on: ubuntu-latest
2121
strategy:
2222
matrix:
23-
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]
23+
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]
2424
steps:
2525
- name: Checkout repository
2626
uses: actions/checkout@v4

.pre-commit-config.yaml

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v3.4.0
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v5.0.0
66
hooks:
7-
- id: trailing-whitespace
8-
- id: end-of-file-fixer
9-
- id: check-yaml
10-
- id: check-added-large-files
11-
- repo: https://github.com/PyCQA/pydocstyle
12-
rev: 6.0.0
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/PyCQA/pydocstyle
12+
rev: 6.3.0
1313
hooks:
14-
- id: pydocstyle
14+
- id: pydocstyle
1515
exclude: |
16-
(?x)^(
17-
tests/.* |
18-
examples/.*
19-
)
20-
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup
21-
rev: v1.0.1
16+
(?x)^(
17+
tests/.* |
18+
examples/.*
19+
)
20+
- repo: https://github.com/psf/black
21+
rev: 24.10.0
22+
hooks:
23+
- id: black
24+
args: [ '--check', 'pytest_reportportal', 'tests' ]
25+
- repo: https://github.com/pycqa/isort
26+
rev: 6.0.0
2227
hooks:
23-
- id: rst-linter
24-
- repo: https://github.com/pycqa/flake8
25-
rev: 5.0.4
28+
- id: isort
29+
- repo: https://github.com/pycqa/flake8
30+
rev: 7.1.1
2631
hooks:
27-
- id: flake8
32+
- id: flake8

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# Changelog
22

33
## [Unreleased]
4+
### Removed
5+
- `Python 3.7` support, by @HardNorth
6+
7+
## [5.4.7]
48
### Added
5-
- Escaping of binary symbol '\0' in parameters, by @HardNorth
9+
- Issue [#382](https://github.com/reportportal/agent-python-pytest/issues/382): Escaping of binary symbol '\0' in parameters, by @HardNorth
10+
### Changed
11+
- Client version updated on [5.6.0](https://github.com/reportportal/client-Python/releases/tag/5.6.0), by @HardNorth
612

713
## [5.4.6]
814
### Added

README.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# ReportPortal integration for pytest framework
2+
3+
Pytest plugin for reporting test results of the Pytest to the ReportPortal.
4+
5+
> **DISCLAIMER**: We use Google Analytics for sending anonymous usage information such as agent's and client's names,
6+
> and their versions after a successful launch start. This information might help us to improve both ReportPortal
7+
> backend and client sides. It is used by the ReportPortal team only and is not supposed for sharing with 3rd parties.
8+
9+
[![PyPI](https://img.shields.io/pypi/v/pytest-reportportal.svg?maxAge=259200)](https://pypi.python.org/pypi/pytest-reportportal)
10+
[![Python versions](https://img.shields.io/pypi/pyversions/pytest-reportportal.svg)](https://pypi.org/project/pytest-reportportal)
11+
[![Tests](https://github.com/reportportal/agent-python-pytest/actions/workflows/tests.yml/badge.svg)](https://github.com/reportportal/agent-python-pytest/actions/workflows/tests.yml)
12+
[![codecov](https://codecov.io/gh/reportportal/agent-python-pytest/graph/badge.svg?token=x5ZHqZKJFV)](https://codecov.io/gh/reportportal/agent-python-pytest)
13+
[![Join Slack chat!](https://img.shields.io/badge/slack-join-brightgreen.svg)](https://slack.epmrpp.reportportal.io/)
14+
[![stackoverflow](https://img.shields.io/badge/reportportal-stackoverflow-orange.svg?style=flat)](http://stackoverflow.com/questions/tagged/reportportal)
15+
[![Build with Love](https://img.shields.io/badge/build%20with-❤%EF%B8%8F%E2%80%8D-lightgrey.svg)](http://reportportal.io?style=flat)
16+
17+
## Installation
18+
19+
To install pytest plugin execute next command in a terminal:
20+
21+
```bash
22+
pip install pytest-reportportal
23+
```
24+
25+
Look through the `CONTRIBUTING.rst` for contribution guidelines.
26+
27+
## Configuration
28+
29+
Prepare the config file `pytest.ini` in root directory of tests or specify any one using pytest command line option:
30+
31+
```bash
32+
py.test -c config.cfg
33+
```
34+
35+
The `pytest.ini` file should have next mandatory fields:
36+
37+
- `rp_api_key` - value could be found in the User Profile section
38+
- `rp_project` - name of project in ReportPortal
39+
- `rp_endpoint` - address of ReportPortal Server
40+
41+
Example of `pytest.ini`:
42+
43+
```text
44+
[pytest]
45+
rp_api_key = fb586627-32be-47dd-93c1-678873458a5f
46+
rp_endpoint = http://192.168.1.10:8080
47+
rp_project = user_personal
48+
rp_launch = AnyLaunchName
49+
rp_launch_attributes = 'PyTest' 'Smoke'
50+
rp_launch_description = 'Smoke test'
51+
rp_ignore_attributes = 'xfail' 'usefixture'
52+
```
53+
54+
- The `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.ini
55+
56+
There are also optional parameters:
57+
https://reportportal.io/docs/log-data-in-reportportal/test-framework-integration/Python/pytest/
58+
59+
## Examples
60+
61+
For logging of the test item flow to ReportPortal, please, use the python logging handler provided by plugin like
62+
below:
63+
64+
in `conftest.py`:
65+
66+
```python
67+
import logging
68+
69+
import pytest
70+
71+
from reportportal_client import RPLogger
72+
73+
74+
@pytest.fixture(scope="session")
75+
def rp_logger():
76+
logger = logging.getLogger(__name__)
77+
logger.setLevel(logging.DEBUG)
78+
logging.setLoggerClass(RPLogger)
79+
return logger
80+
```
81+
82+
in tests:
83+
84+
```python
85+
# In this case only INFO messages will be sent to the ReportPortal.
86+
def test_one(rp_logger):
87+
rp_logger.info("Case1. Step1")
88+
x = "this"
89+
rp_logger.info("x is: %s", x)
90+
assert 'h' in x
91+
92+
# Message with an attachment.
93+
import subprocess
94+
free_memory = subprocess.check_output("free -h".split())
95+
rp_logger.info(
96+
"Case1. Memory consumption",
97+
attachment={
98+
"name": "free_memory.txt",
99+
"data": free_memory,
100+
"mime": "application/octet-stream",
101+
},
102+
)
103+
104+
# This debug message will not be sent to the ReportPortal.
105+
rp_logger.debug("Case1. Debug message")
106+
```
107+
108+
## Launching
109+
110+
To run test with ReportPortal you must provide `--reportportal` flag:
111+
112+
```bash
113+
py.test ./tests --reportportal
114+
```
115+
116+
Check the documentation to find more detailed information about how to integrate pytest with ReportPortal using the
117+
agent:
118+
https://reportportal.io/docs/log-data-in-reportportal/test-framework-integration/Python/pytest/
119+
120+
## Copyright Notice
121+
122+
Licensed under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) license (see the LICENSE file).

README.rst

Lines changed: 0 additions & 141 deletions
This file was deleted.

examples/attributes/test_runtime_attribute.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,5 @@ def test_custom_attributes_report(request):
2020
This is a test with one custom marker as a decorator and one custom marker
2121
added at runtime which shall both appear on ReportPortal on test's item
2222
"""
23-
request.node.add_marker(
24-
pytest.mark.runtime()
25-
)
23+
request.node.add_marker(pytest.mark.runtime())
2624
assert True
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Feature: Four step arguments
2+
Scenario: Arguments for given, when, and, then
3+
Given there are 5 cucumbers
4+
5+
When I eat 3 cucumbers
6+
And I eat 2 cucumbers
7+
8+
Then I should have 0 cucumbers
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Feature: Four step arguments
2+
Description for the feature
3+
4+
Scenario: Arguments for given, when, and, then
5+
Description for the scenario
6+
7+
Given there are 5 cucumbers
8+
When I eat 3 cucumbers
9+
And I eat 2 cucumbers
10+
11+
Then I should have 0 cucumbers

0 commit comments

Comments
 (0)