Skip to content

Commit 13cb4eb

Browse files
committed
Add rp_launch_timeout param
1 parent 0ea47dc commit 13cb4eb

File tree

5 files changed

+14
-1
lines changed

5 files changed

+14
-1
lines changed

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ The following parameters are optional:
120120
- :code:`rp_verify_ssl = True` - Verify SSL when connecting to the server
121121
- :code:`rp_mode = DEFAULT` - DEBUG or DEFAULT launch mode. DEBUG launches are displayed in a separate tab and not visible to anyone except owner
122122
- :code:`rp_thread_logging` - EXPERIMENTAL - Enables support for reporting logs from threads by patching the builtin Thread class. Use with caution.
123+
- :code:`rp_launch_timeout = 86400` - Maximum time to wait for child processes finish, default value: 86400 seconds (1 day)
124+
123125

124126

125127
If you like to override the above parameters from command line, or from CI environment based on your build, then pass

pytest_reportportal/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ def __init__(self, pytest_config):
8282
self.rp_verify_ssl = bool(strtobool(rp_verify_ssl))
8383
except (ValueError, AttributeError):
8484
self.rp_verify_ssl = rp_verify_ssl
85+
self.rp_launch_timeout = int(
86+
self.find_option(pytest_config, 'rp_launch_timeout'))
8587

8688
# noinspection PyMethodMayBeStatic
8789
def find_option(self, pytest_config, option_name, default=None):

pytest_reportportal/config.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class AgentConfig:
3131
rp_skip_connection_test: bool = ...
3232
rp_uuid: Text = ...
3333
rp_verify_ssl: Union[bool, Text] = ...
34+
rp_launch_timeout: int = ...
3435

3536
def __init__(self, pytest_config: Config) -> None: ...
3637

pytest_reportportal/plugin.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,3 +447,9 @@ def add_shared_option(name, help, default=None, action='store'):
447447
default=False,
448448
type='bool',
449449
help='Skip Report Portal connection test')
450+
parser.addini(
451+
'rp_launch_timeout',
452+
default=86400,
453+
help='Maximum time to wait for child processes finish, default value: '
454+
'86400 seconds (1 day)'
455+
)

pytest_reportportal/service.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,9 @@ def finish_suites(self):
791791
at once.
792792
"""
793793
# Ensure there is no running items
794-
while len(self._get_items(ExecStatus.IN_PROGRESS)) > 0:
794+
finish_time = time()
795+
while len(self._get_items(ExecStatus.IN_PROGRESS)) > 0 \
796+
and time() - finish_time <= self._config.rp_launch_timeout:
795797
sleep(0.1)
796798
skipped_items = self._get_items(ExecStatus.CREATED)
797799
for item in skipped_items:

0 commit comments

Comments
 (0)