Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scripts: Fixed several SyntaxWarning for python test helpers #1064

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions scripts/prettyasserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
'assert': ['assert'],
'arrow': ['=>'],
'string': [r'"(?:\\.|[^"])*"', r"'(?:\\.|[^'])\'"],
'paren': ['\(', '\)'],
'paren': [r'\(', r'\)'],
'cmp': CMP.keys(),
'logic': ['\&\&', '\|\|'],
'sep': [':', ';', '\{', '\}', ','],
'logic': [r'\&\&', r'\|\|'],
'sep': [':', ';', r'\{', r'\}', ','],
'op': ['->'], # specifically ops that conflict with cmp
}

Expand Down
38 changes: 19 additions & 19 deletions scripts/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ def parse_define(v):
# the runner itself.
for v_ in csplit(v):
m = re.search(r'\brange\b\s*\('
'(?P<start>[^,\s]*)'
'\s*(?:,\s*(?P<stop>[^,\s]*)'
'\s*(?:,\s*(?P<step>[^,\s]*)\s*)?)?\)',
r'(?P<start>[^,\s]*)'
r'\s*(?:,\s*(?P<stop>[^,\s]*)'
r'\s*(?:,\s*(?P<step>[^,\s]*)\s*)?)?\)',
v_)
if m:
start = (int(m.group('start'), 0)
Expand Down Expand Up @@ -163,8 +163,8 @@ def __init__(self, path, args={}):
code_linenos = []
for i, line in enumerate(f):
match = re.match(
'(?P<case>\[\s*cases\s*\.\s*(?P<name>\w+)\s*\])'
'|' '(?P<code>code\s*=)',
r'(?P<case>\[\s*cases\s*\.\s*(?P<name>\w+)\s*\])'
r'|' r'(?P<code>code\s*=)',
line)
if match and match.group('case'):
case_linenos.append((i+1, match.group('name')))
Expand Down Expand Up @@ -602,9 +602,9 @@ def find_perms(runner_, ids=[], **args):
errors='replace',
close_fds=False)
pattern = re.compile(
'^(?P<case>[^\s]+)'
'\s+(?P<flags>[^\s]+)'
'\s+(?P<filtered>\d+)/(?P<perms>\d+)')
r'^(?P<case>[^\s]+)'
r'\s+(?P<flags>[^\s]+)'
r'\s+(?P<filtered>\d+)/(?P<perms>\d+)')
# skip the first line
for line in it.islice(proc.stdout, 1, None):
m = pattern.match(line)
Expand Down Expand Up @@ -632,8 +632,8 @@ def find_perms(runner_, ids=[], **args):
errors='replace',
close_fds=False)
pattern = re.compile(
'^(?P<case>[^\s]+)'
'\s+(?P<path>[^:]+):(?P<lineno>\d+)')
r'^(?P<case>[^\s]+)'
r'\s+(?P<path>[^:]+):(?P<lineno>\d+)')
# skip the first line
for line in it.islice(proc.stdout, 1, None):
m = pattern.match(line)
Expand Down Expand Up @@ -676,8 +676,8 @@ def find_path(runner_, id, **args):
errors='replace',
close_fds=False)
pattern = re.compile(
'^(?P<case>[^\s]+)'
'\s+(?P<path>[^:]+):(?P<lineno>\d+)')
r'^(?P<case>[^\s]+)'
r'\s+(?P<path>[^:]+):(?P<lineno>\d+)')
# skip the first line
for line in it.islice(proc.stdout, 1, None):
m = pattern.match(line)
Expand Down Expand Up @@ -706,7 +706,7 @@ def find_defines(runner_, id, **args):
errors='replace',
close_fds=False)
defines = co.OrderedDict()
pattern = re.compile('^(?P<define>\w+)=(?P<value>.+)')
pattern = re.compile(r'^(?P<define>\w+)=(?P<value>.+)')
for line in proc.stdout:
m = pattern.match(line)
if m:
Expand Down Expand Up @@ -781,12 +781,12 @@ def run_stage(name, runner_, ids, stdout_, trace_, output_, **args):
failures = []
killed = False

pattern = re.compile('^(?:'
'(?P<op>running|finished|skipped|powerloss) '
'(?P<id>(?P<case>[^:]+)[^\s]*)'
'|' '(?P<path>[^:]+):(?P<lineno>\d+):(?P<op_>assert):'
' *(?P<message>.*)'
')$')
pattern = re.compile(r'^(?:'
r'(?P<op>running|finished|skipped|powerloss) '
r'(?P<id>(?P<case>[^:]+)[^\s]*)'
r'|' r'(?P<path>[^:]+):(?P<lineno>\d+):(?P<op_>assert):'
r' *(?P<message>.*)'
r')$')
locals = th.local()
children = set()

Expand Down
Loading