Mercurial > public > mercurial-scm > hg
comparison tests/check-perf-code.py @ 29570:cbd240188e4e
tests: introduce check-perf-code.py to add extra checks on perf.py
This patch introduces tests/check-perf-code.py as a preparation for
adding extra checks on contrib/perf.py in subsequent patches (mainly,
for historical portability).
At this change, check-perf-code.py doesn't add any extra check, and is
equal to check-code.py. This makes subsequent patch focus only on
adding an extra check on perf.py check-perf-code.py.
check-perf-code.py adds extra checks on perf.py by wrapping
contrib/check-code.py, because "filtering" by check-code.py (e.g.
normalize characters in string literal or comment line) is useful to
simplify regexp for check, and avoid false positive matching.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Fri, 20 May 2016 09:47:35 +0900 |
parents | |
children | d1a7d9c279bb |
comparison
equal
deleted
inserted
replaced
29569:3d52e7c78a6b | 29570:cbd240188e4e |
---|---|
1 #!/usr/bin/env python | |
2 # | |
3 # check-perf-code - (historical) portability checker for contrib/perf.py | |
4 | |
5 from __future__ import absolute_import | |
6 | |
7 import os | |
8 import sys | |
9 | |
10 # write static check patterns here | |
11 perfpypats = [ | |
12 [ | |
13 ], | |
14 # warnings | |
15 [ | |
16 ] | |
17 ] | |
18 | |
19 if __name__ == "__main__": | |
20 # import contrib/check-code.py as checkcode | |
21 assert 'RUNTESTDIR' in os.environ, "use check-perf-code.py in *.t script" | |
22 contribpath = os.path.join(os.environ['RUNTESTDIR'], '..', 'contrib') | |
23 sys.path.insert(0, contribpath) | |
24 checkcode = __import__('check-code') | |
25 | |
26 # register perf.py specific entry with "checks" in check-code.py | |
27 checkcode.checks.append(('perf.py', r'contrib/perf.py$', '', | |
28 checkcode.pyfilters, perfpypats)) | |
29 | |
30 sys.exit(checkcode.main()) |