From c079079b39986e635e29721bf1220c7b4c2055c8 Mon Sep 17 00:00:00 2001 From: Yutong Zhang <90831468+yutongzhang-microsoft@users.noreply.github.com> Date: Thu, 12 Sep 2024 14:45:54 +0800 Subject: [PATCH] [Bugfix] Bugfix for getting maximum matching length of conditional mark. (#14515) Description of PR We changed the matching rule of conditional mark in PR #14395. There is a bug when getting the maximum matching length. In this PR, we fix this bug. Approach What is the motivation for this PR? We changed the matching rule of conditional mark in PR #14395. There is a bug when getting the maximum matching length. In this PR, we fix this bug. co-authorized by: jianquanye@microsoft.com --- tests/common/plugins/conditional_mark/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/common/plugins/conditional_mark/__init__.py b/tests/common/plugins/conditional_mark/__init__.py index f92dc5bfd4..4ff2d5d1a8 100644 --- a/tests/common/plugins/conditional_mark/__init__.py +++ b/tests/common/plugins/conditional_mark/__init__.py @@ -428,7 +428,7 @@ def find_all_matches(nodeid, conditions): marks = match[case_starting_substring].keys() for mark in marks: if mark in conditional_marks: - if length > max_length: + if length >= max_length: conditional_marks.update({ mark: { case_starting_substring: { @@ -441,6 +441,7 @@ def find_all_matches(nodeid, conditions): case_starting_substring: { mark: match[case_starting_substring][mark]} }}) + max_length = length # We may have the same matches of different marks # Need to remove duplicate here