Skip to content

Commit e0eb90b

Browse files
authored
Merge pull request #359 from reportportal/develop
Release
2 parents 0154506 + 0ef78b7 commit e0eb90b

File tree

6 files changed

+22
-142
lines changed

6 files changed

+22
-142
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44
### Changed
5+
- Set upper pytest version limit to not include `8.0.0`, by @HardNorth
6+
7+
## [5.3.1]
8+
### Changed
59
- Client version updated on [5.5.4](https://github.com/reportportal/client-Python/releases/tag/5.5.4), by @HardNorth
610
- `rp_launch_id` property handling moved completely on Client side, by @HardNorth
711

README.rst

Lines changed: 12 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,7 @@ agent-python-pytest
1919
:alt: Join Slack chat!
2020

2121

22-
Pytest plugin for reporting test results of the Pytest to the Report Portal.
23-
24-
* Usage
25-
* Installation
26-
* Configuration
27-
* Examples
28-
* Launching
29-
* Send attachment (screenshots)
30-
* Troubleshooting
31-
* Integration with GA
32-
* Copyright Notice
33-
34-
Usage
35-
-----
22+
Pytest plugin for reporting test results of the Pytest to the ReportPortal.
3623

3724
Installation
3825
~~~~~~~~~~~~
@@ -61,8 +48,8 @@ any one using pytest command line option:
6148
The :code:`pytest.ini` file should have next mandatory fields:
6249

6350
- :code:`rp_api_key` - value could be found in the User Profile section
64-
- :code:`rp_project` - name of project in Report Portal
65-
- :code:`rp_endpoint` - address of Report Portal Server
51+
- :code:`rp_project` - name of project in ReportPortal
52+
- :code:`rp_endpoint` - address of ReportPortal Server
6653

6754
Example of :code:`pytest.ini`:
6855

@@ -79,47 +66,15 @@ Example of :code:`pytest.ini`:
7966
8067
- 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
8168

82-
The following parameters are optional:
83-
84-
- :code:`rp_client_type = SYNC` - Type of the under-the-hood ReportPortal client implementation. Possible values: [SYNC, ASYNC_THREAD, ASYNC_BATCHED].
85-
- :code:`rp_launch = AnyLaunchName` - launch name (could be overridden by pytest --rp-launch option, default value is 'Pytest Launch').
86-
- :code:`rp_launch_id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` - id of the existing launch (the session will not handle the lifecycle of the given launch).
87-
- :code:`rp_launch_attributes = 'PyTest' 'Smoke' 'Env:Python3'` - list of attributes for launch.
88-
- :code:`rp_launch_description = 'Smoke test'` - launch description (could be overridden by pytest --rp-launch-description option, default value is '').
89-
- :code:`rp_launch_timeout = 86400` - Maximum time to wait for child processes finish, default value: 86400 seconds (1 day).
90-
- :code:`rp_launch_uuid_print = True` - Enables printing Launch UUID on test run start. Default `False`.
91-
- :code:`rp_launch_uuid_print_output = stderr` - Launch UUID print output. Default `stdout`. Possible values: [stderr, stdout].
92-
- :code:`rp_parent_item_id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` - id of the existing test item for session to use as parent item for the tests (the session will not handle the lifecycle of the given test item).
93-
- :code:`rp_tests_attributes = 'PyTest' 'Smoke'` - list of attributes that will be added for each item in the launch.
94-
- :code:`rp_connect_timeout = 15` - Connection timeout to ReportPortal server. Default value is "10.0".
95-
- :code:`rp_read_timeout = 15` - Response read timeout for ReportPortal connection. Default value is "10.0".
96-
- :code:`rp_log_batch_size = 20` - size of batch log request.
97-
- :code:`rp_log_batch_payload_size = 65000000` - maximum payload size in bytes of async batch log requests.
98-
- :code:`rp_log_level = INFO` - The log level that will be reported.
99-
- :code:`rp_log_format = [%(levelname)7s] (%(name)s) %(message)s (%(filename)s:%(lineno)s)` - Format string to be used for logs sent to the service.
100-
- :code:`rp_ignore_attributes = 'xfail' 'usefixture'` - Ignore specified pytest markers.
101-
- :code:`rp_is_skipped_an_issue = False` - Treat skipped tests as required investigation. Default `True`.
102-
- :code:`rp_hierarchy_dirs_level = 0` - Directory starting hierarchy level (from pytest.ini level) (default `0`).
103-
- :code:`rp_hierarchy_dirs = True` - Enables hierarchy for tests directories, default `False`. Doesn't support 'xdist' plugin.
104-
- :code:`rp_hierarchy_dir_path_separator` - Path separator to display directories in test hierarchy. In case of empty value current system path separator will be used (os.path.sep).
105-
- :code:`rp_hierarchy_code` - Enables hierarchy for inner classes and parametrized tests, default `False`. Doesn't support 'xdist' plugin.
106-
- :code:`rp_issue_system_url = https://bugzilla.some.com/show_bug.cgi?id={issue_id}` - issue URL (issue_id will be filled by parameter from pytest mark).
107-
- :code:`rp_issue_id_marks = True` - Enables adding marks for issue ids (e.g. "issue:123456").
108-
- :code:`rp_verify_ssl = True` - Verify SSL when connecting to the server.
109-
- :code:`rp_mode = DEFAULT` - DEBUG or DEFAULT launch mode. DEBUG launches are displayed in a separate tab and not visible to anyone except owner.
110-
- :code:`rp_thread_logging` - EXPERIMENTAL - Enables support for reporting logs from threads by patching the builtin Thread class. Use with caution.
111-
- :code:`rp_api_retries = 0` - Amount of retries for performing REST calls to RP server.
112-
113-
114-
115-
If you like to override the above parameters from command line, or from CI environment based on your build, then pass
116-
- :code:`-o "rp_launch_attributes=Smoke Tests"` during invocation.
69+
There are also optional parameters:
70+
https://reportportal.io/docs/log-data-in-reportportal/test-framework-integration/Python/pytest/
11771

11872
Examples
11973
~~~~~~~~
12074

121-
For logging of the test item flow to Report Portal, please, use the python
75+
For logging of the test item flow to ReportPortal, please, use the python
12276
logging handler provided by plugin like bellow:
77+
12378
in conftest.py:
12479

12580
.. code-block:: python
@@ -143,7 +98,7 @@ in tests:
14398

14499
.. code-block:: python
145100
146-
# In this case only INFO messages will be sent to the Report Portal.
101+
# In this case only INFO messages will be sent to the ReportPortal.
147102
def test_one(rp_logger):
148103
rp_logger.info("Case1. Step1")
149104
x = "this"
@@ -162,100 +117,20 @@ in tests:
162117
},
163118
)
164119
165-
# This debug message will not be sent to the Report Portal.
120+
# This debug message will not be sent to the ReportPortal.
166121
rp_logger.debug("Case1. Debug message")
167122
168-
Plugin can report doc-strings of tests as :code:`descriptions`:
169-
170-
.. code-block:: python
171-
172-
def test_one():
173-
"""
174-
Description of the test case which will be sent to Report Portal
175-
"""
176-
pass
177-
178-
Pytest markers will be attached as :code:`attributes` to Report Portal items.
179-
In the following example attributes 'linux' and 'win32' will be used:
180-
181-
.. code-block:: python
182-
183-
import pytest
184-
185-
@pytest.mark.win32
186-
@pytest.mark.linux
187-
def test_one():
188-
pass
189-
190-
If you don't want to attach specific markers, list them in :code:`rp_ignore_attributes` parameter
191-
192-
193123
Launching
194124
~~~~~~~~~
195125

196-
To run test with Report Portal you must provide '--reportportal' flag:
126+
To run test with ReportPortal you must provide '--reportportal' flag:
197127

198128
.. code-block:: bash
199129
200130
py.test ./tests --reportportal
201131
202-
203-
Test issue info
204-
~~~~~~~~~~~~~~~
205-
206-
Some pytest marks could be used to specify information about skipped or failed test result.
207-
208-
The following mark fields are used to get information about test issue:
209-
210-
- :code:`issue_id` - issue id (or list) in tracking system. This id will be added as comment to test fail result. If URL is specified in pytest ini file (see :code:`rp_issue_system_url`), id will added as link to tracking system.
211-
- :code:`reason` - some comment that will be added to test fail description.
212-
- :code:`issue_type` - short name of RP issue type that should be assigned to failed or skipped test.
213-
214-
Example:
215-
216-
.. code-block:: python
217-
218-
@pytest.mark.issue(issue_id="111111", reason="Some bug", issue_type="PB")
219-
def test():
220-
assert False
221-
222-
223-
Send attachment (screenshots)
224-
------------------------------
225-
226-
https://github.com/reportportal/client-Python#send-attachment-screenshots
227-
228-
Test internal steps, aka "Nested steps"
229-
---------------------------------------
230-
231-
To implement Nested steps reporting please follow our guide: https://github.com/reportportal/client-Python/wiki/Nested-steps
232-
233-
Also there are examples of usage:
234-
235-
* https://github.com/reportportal/examples-python/blob/master/pytest/tests/test_nested_steps.py
236-
* https://github.com/reportportal/examples-python/blob/master/pytest/tests/test_nested_steps_ui.py
237-
238-
Troubleshooting
239-
~~~~~~~~~~~~~~~
240-
If you would like to temporary disable integrations with Report Portal just
241-
deactivate :code:`pytest_reportportal` plugin with command like:
242-
243-
.. code-block:: bash
244-
245-
py.test -p no:pytest_reportportal ./tests
246-
247-
248-
Integration with Google analytics
249-
---------------------------------
250-
ReportPortal is now supporting integrations with more than 15 test frameworks simultaneously. In order to define the most popular agents and plan the team workload accordingly, we are using Google analytics.
251-
252-
ReportPortal collects information about agent name and its version only. This information is sent to Google Analytics on the launch start. Please help us to make our work effective.
253-
If you still want to switch Off Google analytics, please change env variable the way below.
254-
255-
.. code-block:: bash
256-
257-
export AGENT_NO_ANALYTICS=1
258-
132+
Check the documentation to find more detailed information about how to integrate pytest with ReportPortal using an agent:
133+
https://reportportal.io/docs/log-data-in-reportportal/test-framework-integration/Python/pytest/
259134

260135
Copyright Notice
261136
----------------

requirements-dev.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
delayed-assert
2+
pytest-cov
3+
pytest-parallel

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dill>=0.3.6
2-
pytest>=3.8.0
2+
pytest>=3.8.0,<8.0.0
33
reportportal-client~=5.5.4
44
aenum>=3.1.0
55
requests>=2.28.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from setuptools import setup
1919

2020

21-
__version__ = '5.3.1'
21+
__version__ = '5.3.2'
2222

2323

2424
def read_file(fname):

tox.ini

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ envlist =
1111
[testenv]
1212
deps =
1313
-rrequirements.txt
14-
delayed-assert
15-
pytest-cov
16-
pytest-parallel
14+
-rrequirements-dev.txt
1715

1816
setenv =
1917
AGENT_NO_ANALYTICS = 1

0 commit comments

Comments
 (0)