-
Notifications
You must be signed in to change notification settings - Fork 107
Expand file tree
/
Copy pathtest_empty_run.py
More file actions
41 lines (32 loc) · 1.68 KB
/
test_empty_run.py
File metadata and controls
41 lines (32 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Copyright (c) 2023 https://reportportal.io .
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License
"""This module includes integration tests for the empty run."""
from datetime import datetime, timezone
from unittest import mock
from tests import REPORT_PORTAL_SERVICE
from tests.helpers import utils
@mock.patch(REPORT_PORTAL_SERVICE)
def test_empty_run(mock_client_init):
"""Verify that RP plugin does not fail if there is not tests in run.
:param mock_client_init: Pytest fixture
"""
test_start_time = datetime.now(timezone.utc)
result = utils.run_pytest_tests(tests=["examples/empty/"])
assert int(result) == 5, "Exit code should be 5 (no tests)"
mock_client = mock_client_init.return_value
assert mock_client.start_launch.call_count == 1, '"start_launch" method was not called'
assert mock_client.finish_launch.call_count == 1, '"finish_launch" method was not called'
finish_args = mock_client.finish_launch.call_args_list
assert "status" not in finish_args[0][1], "Launch status should not be defined"
launch_end_time = finish_args[0][1]["end_time"]
assert launch_end_time is not None and launch_end_time > test_start_time, "Launch end time is empty"