Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenyu-ms committed Jan 10, 2025
1 parent 104c2d4 commit aed2e7a
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from itertools import chain, cycle, repeat
from operator import eq

Expand Down Expand Up @@ -159,14 +160,15 @@ 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.
---
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)
Expand All @@ -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

Expand Down

0 comments on commit aed2e7a

Please sign in to comment.