Skip to content

Commit 269f21b

Browse files
committed
Fixes #390
1 parent 986030a commit 269f21b

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2025 EPAM Systems
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import pytest
16+
17+
18+
@pytest.fixture
19+
def fixture_demo():
20+
pytest.exit("Some Message")
21+
22+
23+
def test_exit(fixture_demo):
24+
assert True

tests/integration/test_fixtures.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,3 +587,20 @@ def test_fixture_setup_skip(mock_client_init):
587587

588588
finish_call_kwargs = call_args[-1][1]
589589
assert finish_call_kwargs["status"] == "SKIPPED"
590+
591+
592+
@mock.patch(REPORT_PORTAL_SERVICE)
593+
def test_fixture_exit(mock_client_init):
594+
mock_client = setup_mock_for_logging(mock_client_init)
595+
596+
test_path = "examples/fixtures/test_fixture_exit/test_fixture_exit.py"
597+
variables = dict(utils.DEFAULT_VARIABLES)
598+
variables["rp_report_fixtures"] = True
599+
result = utils.run_pytest_tests(tests=[test_path], variables=variables)
600+
assert int(result) == 2, "Exit code should be 2 (unexpected exit)"
601+
602+
call_args = mock_client.start_test_item.call_args_list
603+
assert len(call_args) == 2, 'Incorrect number of "start_test_item" calls'
604+
605+
call_args = mock_client.finish_test_item.call_args_list
606+
assert len(call_args) == 2, 'Incorrect number of "finish_test_item" calls'

0 commit comments

Comments
 (0)