Skip to content

Commit

Permalink
[PR Validation] Let markers checker match marker from whole text inst…
Browse files Browse the repository at this point in the history
…ead of single line (#16571)

In PR #16069, the PR validation pipeline failed on error: Please add mark pytest.mark.topology in script bgp/test_ipv6_bgp_scale.py.

After debugging, I found that the pipeline match the pattern per line, so it will not match the marker in format:

pytestmark = [
    pytest.mark.topology(
        't0-isolated-d2u254s1', 't0-isolated-d2u254s2', 't0-isolated-d2u510',
        't1-isolated-d254u2s1', 't1-isolated-d254u2s2', 't1-isolated-d510u2'
    )
]
However, If I write all mark in same line, it will exceed the maximum line length, so I raise this PR to let mark checker match pattern from whole script instead of lines.

What is the motivation for this PR?
In summary section.

How did you do it?
let mark checker match pattern from whole script instead of lines.

How did you verify/test it?
trigger pipeline by this PR.
run script locally.
Any platform specific information?
NA
  • Loading branch information
w1nda authored Jan 20, 2025
1 parent 3732b8e commit af0c5c8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions .azure-pipelines/markers_check/markers_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,10 @@ def collect_scripts_without_topology_markers():
script_name = s[len(location) + 1:]
try:
with open(s, 'r') as script:
for line in script:
# Get topology type of script from marker `pytest.mark.topology`
match = pattern.search(line)
if match:
has_markers = True
break
match = pattern.search(script.read())
if match:
has_markers = True
break

if not has_markers:
scripts_without_marker.append(script_name)
Expand Down

0 comments on commit af0c5c8

Please sign in to comment.