Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cython
Commits
bcec0132
Commit
bcec0132
authored
Jan 03, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make test runner bark at unknown tag names in test files
parent
c994f01b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
6 deletions
+19
-6
runtests.py
runtests.py
+19
-6
No files found.
runtests.py
View file @
bcec0132
...
@@ -299,20 +299,33 @@ def memoize(f):
...
@@ -299,20 +299,33 @@ def memoize(f):
@memoize
@memoize
def parse_tags(filepath):
def parse_tags(filepath):
tags = defaultdict(list)
tags = defaultdict(list)
parse_tag = re.compile(r'#
\
s*(
\
w+)
\
s*:(.*)$
'
).match
f = io_open(filepath, encoding='ISO-8859-1', errors='ignore')
f = io_open(filepath, encoding='ISO-8859-1', errors='ignore')
try:
try:
for line in f:
for line in f:
# ignore BOM-like bytes and whitespace
# ignore BOM-like bytes and whitespace
line = line.lstrip(UTF8_BOM_BYTES).strip()
line = line.lstrip(UTF8_BOM_BYTES).strip()
if not line:
if not line:
if tags:
break # assume all tags are in one block
else:
continue
continue
if line[0] != '#':
if line[0] != '#':
break
break
ix = line.find(':')
parsed = parse_tag(line)
if ix != -1:
if parsed:
tag = line[1:ix].strip()
tag, values = parsed.groups()
values = line[ix+1:].split(',')
if tag in ('coding', 'encoding'):
tags[tag].extend([value.strip() for value in values])
continue
if tag == 'tags':
tag = 'tag'
print("
WARNING
:
test
tags
use
the
'tag'
directive
,
not
'tags'
(
%
s
)
" % filepath)
if tag not in ('mode', 'tag', 'ticket', 'cython'):
print("
WARNING
:
unknown
test
directive
'%s'
found
(
%
s
)
" % (tag, filepath))
values = values.split(',')
tags[tag].extend(filter(None, [value.strip() for value in values]))
elif tags:
break # assume all tags are in one block
finally:
finally:
f.close()
f.close()
return tags
return tags
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment