[PATCH] tests: do not reexecute the code-check a 2nd time for all exceptions
Simon Heimberg
simohe at besonet.ch
Mon Nov 5 16:21:10 CST 2012
# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1351147156 -7200
# Branch stable
# Node ID 3129e7d421822f928111770981afda8a8e5d4a1a
# Parent 538f13ac1db8cf34ded3d677003aafcee7de9e9a
tests: do not reexecute the code-check a 2nd time for all exceptions
We do not gain anything by running the normal tests twice when running
test-check-code-hg.py.
To avoid this add option --only-warnings to code-check.py and use it in
the test.
diff -r 538f13ac1db8 -r 3129e7d42182 contrib/check-code.py
--- a/contrib/check-code.py Mit Okt 24 23:09:32 2012 +0200
+++ b/contrib/check-code.py Don Okt 25 08:39:16 2012 +0200
@@ -319,7 +319,7 @@
return lines
def checkfile(f, logfunc=_defaultlogger.log, maxerr=None, warnings=False,
- blame=False, debug=False, lineno=True):
+ only_warn=False, blame=False, debug=False, lineno=True):
"""checks style and portability of a given file
:f: filepath
@@ -353,6 +353,8 @@
post = re.sub(p, r, post)
if warnings:
pats = pats[0] + pats[1]
+ elif only_warn:
+ pats = pats[1]
else:
pats = pats[0]
# print post # uncomment to show filtered version
@@ -427,6 +429,8 @@
parser = optparse.OptionParser("%prog [options] [files]")
parser.add_option("-w", "--warnings", action="store_true",
help="include warning-level checks")
+ parser.add_option("", "--only-warnings", action="store_true",
+ help="only do warning level checks (for test suite)")
parser.add_option("-p", "--per-file", type="int",
help="max warnings per file")
parser.add_option("-b", "--blame", action="store_true",
@@ -448,7 +452,7 @@
ret = 0
for f in check:
if not checkfile(f, maxerr=options.per_file, warnings=options.warnings,
- blame=options.blame, debug=options.debug,
- lineno=options.lineno):
+ only_warn=options.only_warnings, blame=options.blame,
+ debug=options.debug, lineno=options.lineno):
ret = 1
sys.exit(ret)
diff -r 538f13ac1db8 -r 3129e7d42182 tests/test-check-code-hg.t
--- a/tests/test-check-code-hg.t Mit Okt 24 23:09:32 2012 +0200
+++ b/tests/test-check-code-hg.t Don Okt 25 08:39:16 2012 +0200
@@ -7,7 +7,8 @@
> fi
$ hg manifest | xargs "$check_code" || echo 'FAILURE IS NOT AN OPTION!!!'
- $ hg manifest | xargs "$check_code" --warnings --nolineno --per-file=0 || true
+ $ hg manifest |
+ > xargs "$check_code" --only-warnings --nolineno --per-file=0 || true
hgext/convert/cvsps.py:0:
> ui.write('Ancestors: %s\n' % (','.join(r)))
warning: unwrapped ui message
More information about the Mercurial-devel
mailing list