|
1 | 1 | """This module contains changed pytest for report-portal.""" |
2 | 2 |
|
| 3 | +# Copyright (c) 2023 https://reportportal.io . |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License |
| 15 | + |
3 | 16 | import logging |
4 | | -# This program is free software: you can redistribute it |
5 | | -# and/or modify it under the terms of the GPL licence |
6 | 17 | import os.path |
7 | 18 | import time |
8 | 19 |
|
@@ -59,8 +70,9 @@ def wait_launch(rp_client): |
59 | 70 | timeout = time.time() + LAUNCH_WAIT_TIMEOUT |
60 | 71 | while not rp_client.launch_id: |
61 | 72 | if time.time() > timeout: |
62 | | - raise Exception("Launch has not started.") |
| 73 | + return False |
63 | 74 | time.sleep(1) |
| 75 | + return True |
64 | 76 |
|
65 | 77 |
|
66 | 78 | # noinspection PyProtectedMember |
@@ -90,7 +102,12 @@ def pytest_sessionstart(session): |
90 | 102 | config.py_test_service.start_launch() |
91 | 103 | if config.pluginmanager.hasplugin('xdist') \ |
92 | 104 | or config.pluginmanager.hasplugin('pytest-parallel'): |
93 | | - wait_launch(session.config.py_test_service.rp) |
| 105 | + if not wait_launch(session.config.py_test_service.rp): |
| 106 | + log.error('Failed to initialize reportportal-client service. ' |
| 107 | + 'Waiting for Launch start timed out. ' |
| 108 | + 'Reporting is disabled.') |
| 109 | + config.py_test_service.rp = None |
| 110 | + config._rp_enabled = False |
94 | 111 |
|
95 | 112 |
|
96 | 113 | def pytest_collection_finish(session): |
|
0 commit comments