1111import pytest
1212import requests
1313from reportportal_client import RPLogHandler
14- from reportportal_client .core .log_manager import MAX_LOG_BATCH_PAYLOAD_SIZE
1514from reportportal_client .errors import ResponseError
15+ from reportportal_client .logs .log_manager import MAX_LOG_BATCH_PAYLOAD_SIZE
1616
1717from pytest_reportportal import LAUNCH_WAIT_TIMEOUT
1818from .config import AgentConfig
@@ -34,6 +34,7 @@ def pytest_configure_node(node):
3434
3535 :param node: Object of the xdist WorkerController class
3636 """
37+ # noinspection PyProtectedMember
3738 if not node .config ._rp_enabled :
3839 # Stop now if the plugin is not properly configured
3940 return
@@ -62,6 +63,7 @@ def wait_launch(rp_client):
6263 time .sleep (1 )
6364
6465
66+ # noinspection PyProtectedMember
6567def pytest_sessionstart (session ):
6668 """Start Report Portal launch.
6769
@@ -96,13 +98,15 @@ def pytest_collection_finish(session):
9698
9799 :param session: Object of the pytest Session class
98100 """
101+ # noinspection PyProtectedMember
99102 if not session .config ._rp_enabled :
100103 # Stop now if the plugin is not properly configured
101104 return
102105
103106 session .config .py_test_service .collect_tests (session )
104107
105108
109+ # noinspection PyProtectedMember
106110def pytest_sessionfinish (session ):
107111 """Finish current test session.
108112
@@ -162,6 +166,7 @@ def check_connection(agent_config):
162166 return False
163167
164168
169+ # noinspection PyProtectedMember
165170def pytest_configure (config ):
166171 """Update Config object with attributes required for reporting to RP.
167172
@@ -204,6 +209,7 @@ def pytest_configure(config):
204209 config .workerinput ['py_test_service' ])
205210
206211
212+ # noinspection PyProtectedMember
207213@pytest .hookimpl (hookwrapper = True )
208214def pytest_runtestloop (session ):
209215 """
@@ -222,6 +228,7 @@ def pytest_runtestloop(session):
222228 yield
223229
224230
231+ # noinspection PyProtectedMember
225232@pytest .hookimpl (hookwrapper = True )
226233def pytest_runtest_protocol (item ):
227234 """
@@ -253,6 +260,7 @@ def pytest_runtest_protocol(item):
253260 service .finish_pytest_item (item )
254261
255262
263+ # noinspection PyProtectedMember
256264@pytest .hookimpl (hookwrapper = True )
257265def pytest_runtest_makereport (item ):
258266 """
@@ -278,28 +286,28 @@ def pytest_addoption(parser):
278286 """
279287 group = parser .getgroup ('reporting' )
280288
281- def add_shared_option (name , help , default = None , action = 'store' ):
289+ def add_shared_option (name , help_str , default = None , action = 'store' ):
282290 """
283291 Add an option to both the command line and the .ini file.
284292
285293 This function modifies `parser` and `group` from the outer scope.
286294
287295 :param name: name of the option
288- :param help: help message
296+ :param help_str: help message
289297 :param default: default value
290298 :param action: `group.addoption` action
291299 """
292300 parser .addini (
293301 name = name ,
294302 default = default ,
295- help = help ,
303+ help = help_str ,
296304 )
297305 group .addoption (
298306 '--{0}' .format (name .replace ('_' , '-' )),
299307 action = action ,
300308 dest = name ,
301309 help = '{help} (overrides {name} config option)' .format (
302- help = help ,
310+ help = help_str ,
303311 name = name ,
304312 ),
305313 )
@@ -313,57 +321,57 @@ def add_shared_option(name, help, default=None, action='store'):
313321 )
314322 add_shared_option (
315323 name = 'rp_launch' ,
316- help = 'Launch name' ,
324+ help_str = 'Launch name' ,
317325 default = 'Pytest Launch' ,
318326 )
319327 add_shared_option (
320328 name = 'rp_launch_id' ,
321- help = 'Use already existing launch-id. The plugin won\' t control the '
322- ' Launch status' ,
329+ help_str = 'Use already existing launch-id. The plugin won\' t control '
330+ 'the Launch status' ,
323331 )
324332 add_shared_option (
325333 name = 'rp_launch_description' ,
326- help = 'Launch description' ,
334+ help_str = 'Launch description' ,
327335 default = '' ,
328336 )
329- add_shared_option (name = 'rp_project' , help = 'Project name' )
337+ add_shared_option (name = 'rp_project' , help_str = 'Project name' )
330338 add_shared_option (
331339 name = 'rp_log_level' ,
332- help = 'Logging level for automated log records reporting' ,
340+ help_str = 'Logging level for automated log records reporting' ,
333341 )
334342 add_shared_option (
335343 name = 'rp_log_format' ,
336- help = 'Logging format for automated log records reporting' ,
344+ help_str = 'Logging format for automated log records reporting' ,
337345 )
338346 add_shared_option (
339347 name = 'rp_rerun' ,
340- help = 'Marks the launch as a rerun' ,
348+ help_str = 'Marks the launch as a rerun' ,
341349 default = False ,
342350 action = 'store_true' ,
343351 )
344352 add_shared_option (
345353 name = 'rp_rerun_of' ,
346- help = 'ID of the launch to be marked as a rerun (use only with '
347- 'rp_rerun=True)' ,
354+ help_str = 'ID of the launch to be marked as a rerun (use only with '
355+ 'rp_rerun=True)' ,
348356 default = '' ,
349357 )
350358 add_shared_option (
351359 name = 'rp_parent_item_id' ,
352- help = 'Create all test item as child items of the given (already '
353- 'existing) item.' ,
360+ help_str = 'Create all test item as child items of the given (already '
361+ 'existing) item.' ,
354362 )
355- add_shared_option (name = 'rp_uuid' , help = 'UUID' )
356- add_shared_option (name = 'rp_endpoint' , help = 'Server endpoint' )
363+ add_shared_option (name = 'rp_uuid' , help_str = 'UUID' )
364+ add_shared_option (name = 'rp_endpoint' , help_str = 'Server endpoint' )
357365 add_shared_option (
358366 name = 'rp_mode' ,
359- help = 'Visibility of current launch [DEFAULT, DEBUG]' ,
367+ help_str = 'Visibility of current launch [DEFAULT, DEBUG]' ,
360368 default = 'DEFAULT'
361369 )
362370 add_shared_option (
363371 name = 'rp_thread_logging' ,
364- help = 'EXPERIMENTAL: Report logs from threads. '
365- 'This option applies a patch to the builtin Thread class, '
366- 'and so it is turned off by default. Use with caution.' ,
372+ help_str = 'EXPERIMENTAL: Report logs from threads. '
373+ 'This option applies a patch to the builtin Thread class, '
374+ 'and so it is turned off by default. Use with caution.' ,
367375 default = False ,
368376 action = 'store_true'
369377 )
0 commit comments