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

Add a hg() method on BaseTestSuite

This is a wrapper to check_output that run currently benchmarked hg
(self.hgpath).
This also use the repository in self.repo_path by default but others can be
used (especially useful for exchange benchmarks).

The goal is to use this wrapper everywere instead of specific wrappers
(_execute, _single_execute, subprocess.check_output) in next changesets.
parent 4ef570a3
No related branches found
No related tags found
No related merge requests found
......@@ -200,6 +200,19 @@
raise RuntimeError('unexpected return code 0 for {}'.format(cmd))
return output
def hg(self, *args, **kwargs):
"""Run given command arguments with hg
When there is no '--cwd' in arguments, use the benchmarked repo with
'hg --cwd /path/to/repo'
"""
if '--cwd' not in args:
# use self.repo_path as repo
cmd = [self.hgpath, '--cwd', self.repo_path] + list(args)
else:
cmd = [self.hgpath] + list(args)
return self.check_output(*cmd, **kwargs)
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