Skip to content

Commit

Permalink
Fix pyexit merges
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarbette committed Jun 28, 2024
1 parent 9713889 commit 8614a90
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 8 additions & 5 deletions npf/section.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import ast

import sre_constants
from typing import List, Set
from collections.abc import Mapping

Expand Down Expand Up @@ -102,7 +101,11 @@ def build(test, data):
return s

if sectionName.startswith('pyexit'):
name = matcher.group("PyExitName").strip()
pg = matcher.group("PyExitName")
if pg:
name = pg.strip()
else:
name = ""
s = SectionPyExit(name)
return s

Expand Down Expand Up @@ -244,8 +247,8 @@ def __init__(self, name = ""):
self.index = ++self.num
self.name = name

def finish(self, testie):
testie.pyexits.append(self)
def finish(self, test):
test.pyexits.append(self)

def get_name(self, full=False):
if self.name != "":
Expand Down Expand Up @@ -838,7 +841,7 @@ def match(self, key, val):
for match in self.get_list(key):
if re.match(match, val):
return True
except sre_constants.error:
except Exception:
print("ERROR : Regex %s does not work" % key)
return False

Expand Down
5 changes: 3 additions & 2 deletions npf/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,12 @@ def __init__(self, test_path, options, tags=None, role=None, inline=None):
self.imports = []
self.requirements = []
self.sendfile = {}
self.filename = os.path.basename(testie_path)
self.path = os.path.dirname(os.path.abspath(testie_path))
self.filename = os.path.basename(test_path)
self.path = os.path.dirname(os.path.abspath(test_path))
self.options = options
self.tags = tags if tags else []
self.role = role
self.pyexits = []

i = -1
try:
Expand Down

0 comments on commit 8614a90

Please sign in to comment.