From 17687522072af3834bc914f49b75c2404cbc4857 Mon Sep 17 00:00:00 2001 From: davidm-arista <110118131+davidm-arista@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:23:33 -0700 Subject: [PATCH] Ensure pre-test is the first item in conditional mark check (#20382) Ensure pre-test is first item in conditional mark check, because pre-test runs before everything else, and it makes the most sense at the top of the file. Also this change goes with #20326 This change will allow that PR to pass its PR checks. --- .hooks/pre_commit_hooks/check_conditional_mark_sort.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.hooks/pre_commit_hooks/check_conditional_mark_sort.py b/.hooks/pre_commit_hooks/check_conditional_mark_sort.py index 2c1f480b726..9ad3a7e2cfe 100755 --- a/.hooks/pre_commit_hooks/check_conditional_mark_sort.py +++ b/.hooks/pre_commit_hooks/check_conditional_mark_sort.py @@ -14,6 +14,14 @@ def main(): for line in file_contents: if re.match('^[a-zA-Z]', line): conditions.append(line.strip().rstrip(":")) + if conditions[0] == 'test_pretest.py': + del conditions[0] # This is at front where it should be + if 'test_pretest.py' in conditions: + print("===========================================================================") + print("test_pretest.py should be the first item in ") + print("tests/common/plugins/conditional_mark/tests_mark_conditions*.yaml") + print("===========================================================================") + return 1 sorted_conditions = conditions[:] sorted_conditions.sort() for i in range(len(conditions)):