Skip to content

Commit 3fd95aa

Browse files
committed
test: fix regex rule compilation in tests
1 parent 163b773 commit 3fd95aa

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

scripts/version_scanner/tests/unit/test_version_scanner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,9 +526,11 @@ def test_scan_file_truncation_bug(tmp_path):
526526
# Init config for 3.1
527527
config_manager = ConfigManager("regex_config.yaml", "python", "3.1")
528528
rules = config_manager.load_config()
529+
import re
530+
compiled_rules = [{"name": r["name"], "pattern": re.compile(r["pattern"], re.IGNORECASE)} for r in rules]
529531

530532
# It should not match anything because all strings are 3.10, not 3.1
531-
matches = scan_file(str(test_file), rules)
533+
matches = scan_file(str(test_file), compiled_rules)
532534
assert len(matches) == 0, f"Expected 0 matches for 3.1 in 3.10 content, but got {len(matches)}: {matches}"
533535

534536

0 commit comments

Comments
 (0)