From aed2e7ac42694203a3ec48c3d36527c65d240b6a Mon Sep 17 00:00:00 2001 From: zhenyu-ms <111329301+zhenyu-ms@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:10:17 +0800 Subject: [PATCH] update test --- .../testplan/testing/multitest/test_multitest_parts.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/functional/testplan/testing/multitest/test_multitest_parts.py b/tests/functional/testplan/testing/multitest/test_multitest_parts.py index e13e7c24c..933c07237 100644 --- a/tests/functional/testplan/testing/multitest/test_multitest_parts.py +++ b/tests/functional/testplan/testing/multitest/test_multitest_parts.py @@ -1,3 +1,4 @@ +import re from itertools import chain, cycle, repeat from operator import eq @@ -159,7 +160,7 @@ def test_multi_parts_incorrect_schedule(): ) -def test_multi_parts_duplicate_part(): +def test_multi_parts_duplicate_part(mocker): """ Execute MultiTest parts with a part of MultiTest has been scheduled twice and automatically be filtered out. @@ -167,6 +168,7 @@ def test_multi_parts_duplicate_part(): since multi_part_uid has no functional effect now, original test is invalid preserved for simple backward compatibility test, i.e. no exception raised """ + mock_warn = mocker.patch("warnings.warn") plan = TestplanMock(name="plan", merge_scheduled_parts=True) pool = ThreadPool(name="MyThreadPool", size=2) plan.add_resource(pool) @@ -179,6 +181,8 @@ def test_multi_parts_duplicate_part(): task = Task(target=get_mtest_with_custom_uid(part_tuple=(1, 3))) plan.schedule(task, resource="MyThreadPool") + assert mock_warn.call_count == 4 + assert re.search(r"remove.*multi_part_uid", mock_warn.call_args[0][0]) assert len(plan._tests) == 3 assert plan.run().run is True