|
16 | 16 | import warnings |
17 | 17 | from unittest import mock |
18 | 18 |
|
| 19 | +import pytest |
| 20 | + |
19 | 21 | from delayed_assert import expect, assert_expectations |
20 | 22 | from reportportal_client import OutputType |
21 | 23 |
|
@@ -248,8 +250,7 @@ def test_rp_api_retries(mock_client_init): |
248 | 250 | variables.update({'rp_api_retries': str(retries)}.items()) |
249 | 251 |
|
250 | 252 | with warnings.catch_warnings(record=True) as w: |
251 | | - result = utils.run_pytest_tests(['examples/test_rp_logging.py'], |
252 | | - variables=variables) |
| 253 | + result = utils.run_pytest_tests(['examples/test_rp_logging.py'], variables=variables) |
253 | 254 | assert int(result) == 0, 'Exit code should be 0 (no errors)' |
254 | 255 |
|
255 | 256 | expect(mock_client_init.call_count == 1) |
@@ -324,3 +325,28 @@ def test_no_launch_uuid_print(mock_client_init): |
324 | 325 | expect(mock_client_init.call_args_list[0][1]['launch_uuid_print'] is False) |
325 | 326 | expect(mock_client_init.call_args_list[0][1]['print_output'] is None) |
326 | 327 | assert_expectations() |
| 328 | + |
| 329 | + |
| 330 | +@pytest.mark.parametrize( |
| 331 | + 'connect_value, read_value, expected_result', |
| 332 | + [ |
| 333 | + ('5', '15', (5.0, 15.0)), |
| 334 | + ('5.5', '15.5', (5.5, 15.5)), |
| 335 | + (None, None, None), |
| 336 | + (None, '5', 5), |
| 337 | + ('5', None, 5) |
| 338 | + ] |
| 339 | +) |
| 340 | +@mock.patch(REPORT_PORTAL_SERVICE) |
| 341 | +def test_client_timeouts(mock_client_init, connect_value, read_value, expected_result): |
| 342 | + variables = utils.DEFAULT_VARIABLES.copy() |
| 343 | + if connect_value: |
| 344 | + variables['rp_connect_timeout'] = connect_value |
| 345 | + if read_value: |
| 346 | + variables['rp_read_timeout'] = read_value |
| 347 | + |
| 348 | + result = utils.run_pytest_tests(['examples/test_rp_logging.py'], variables=variables) |
| 349 | + |
| 350 | + assert int(result) == 0, 'Exit code should be 0 (no errors)' |
| 351 | + assert mock_client_init.call_count == 1 |
| 352 | + assert mock_client_init.call_args_list[0][1]['http_timeout'] == expected_result |
0 commit comments