Skip to content
Snippets Groups Projects
Commit 2f723801 authored by Philippe Pepiot's avatar Philippe Pepiot
Browse files

Add a perfext() method to BaseTestSuite

This will be used to run perf.py based track benchmark on classes inheriting
from BaseTestSuite.
parent 08caf7d5
No related branches found
No related tags found
No related merge requests found
......@@ -247,6 +247,23 @@
raise
raise
def perfext(self, command, *args, **kwargs):
"""Use contrib/perf.py extension from mercurial to get a benchmark result"""
perfpath = os.path.join(self.project_dir, 'contrib', 'perf.py')
kwargs.setdefault('stderr', subprocess.STDOUT)
try:
output = self.safe_hg(
[command, '--config', 'extensions.perf={0}'.format(perfpath)],
*args, **kwargs)
except SkipResult:
# command does not exist for this version of perf.py
# return NaN which is a "n/a" status for asv
return float('nan')
match = PERF_RE.search(output)
if not match:
raise ValueError("Invalid output {0}".format(output))
return float(match.group(1))
def setup(self, repo_name, *args, **kwargs):
venv = os.path.abspath(os.path.join(os.path.dirname(sys.executable), ".."))
self.repo_name = repo_name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment