Skip to content

Commit

Permalink
Fix check_must_contain_regex in verify_archive.bzl (#910)
Browse files Browse the repository at this point in the history
* Fix check_must_contain_regex in verify_archive.bzl

* fix the Python template test class
  • Loading branch information
krakeusz authored Jan 13, 2025
1 parent 7b7bcb6 commit c5c6879
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/verify_archive_test_main.py.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,12 @@ class VerifyArchiveTest(unittest.TestCase):
if r_comp.match(path):
matched = True
break
if not match:
if not matched:
self.fail('Did not find pattern (%s) in the archive' % pattern)

def check_must_not_contain_regex(self, must_not_contain_regex):
for pattern in must_not_contain_regex:
r_comp = re.compile(pattern)
matched = False
for path in self.paths:
if r_comp.match(path):
self.fail('Found disallowed pattern (%s) in the archive' % pattern)
Expand Down Expand Up @@ -134,10 +133,10 @@ class ${TEST_NAME}(VerifyArchiveTest):
def test_must_not_contain(self):
self.check_must_not_contain(${MUST_NOT_CONTAIN})

def test_must_not_contain(self):
def test_must_contain_regex(self):
self.check_must_contain_regex(${MUST_CONTAIN_REGEX})

def test_must_not_contain(self):
def test_must_not_contain_regex(self):
self.check_must_not_contain_regex(${MUST_NOT_CONTAIN_REGEX})

def test_verify_links(self):
Expand Down

0 comments on commit c5c6879

Please sign in to comment.