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

Handle params "repo_type" and "revset" Mixin class

In following changesets we will add exchanges benchmarks not using "strip" or
"revset" params.

Moving this outside of the BaseExchangeTimeSuite allow to re-use this logic
without inheriting from it.
parent dbf6c2ca5ed8
No related branches found
No related tags found
No related merge requests found
......@@ -233,14 +233,7 @@
self.thread.join()
class BaseExchangeTimeSuite(BaseTestSuite):
param_names = BaseTestSuite.param_names + [
'repo_type', 'strip', 'revset']
params = BaseTestSuite.params + [
['local', 'ssh', 'http'],
get_strip_variants(),
[None, 'tip']]
timeout = 1800
class BaseExchangeMixin(object):
def _remote_path_cmd(self, path):
if self.repo_type == 'local':
......@@ -265,6 +258,36 @@
else:
raise NotImplementedError
def _setup_repo_type(self, repo_type):
self._hgserve = None
if repo_type == 'http' and self.get_asv_rev() in self.get_skip()['hgweb']:
raise NotImplementedError
self.repo_type = repo_type
if repo_type == 'http':
self._hgserve = HgWeb()
self.hgport = self._hgserve.start(self.hgpath, self.environ)
def _teardown_repo_type(self):
if self._hgserve is not None:
self._hgserve.stop()
self._hgserve = None
def _setup_revset(self, revset):
if revset is not None:
self.rev = self.hg('identify', '-i', '-r', revset).strip()
else:
self.rev = None
class BaseExchangeTimeSuite(BaseExchangeMixin, BaseTestSuite):
param_names = BaseTestSuite.param_names + [
'repo_type', 'strip', 'revset']
params = BaseTestSuite.params + [
['local', 'ssh', 'http'],
get_strip_variants(),
[None, 'tip']]
timeout = 1800
def run(self, local_repo, command, remote_repo, expected_return_code=None):
if not isinstance(command, (list, tuple)):
command = [command]
......@@ -276,11 +299,14 @@
expected_return_code = 1 if self.strip == "same" else 0
self.hg(*cmd, expected_return_code=expected_return_code)
def setup(self, repo_name, repo_type, strip, revset):
super(BaseExchangeTimeSuite, self).setup(repo_name)
self._hgserve = None
if repo_type == 'http' and self.get_asv_rev() in self.get_skip()['hgweb']:
raise NotImplementedError
def setup(self, *args):
args = list(args)
revset = args.pop(-1)
self.strip = args.pop(-1)
repo_type = args.pop(-1)
super(BaseExchangeTimeSuite, self).setup(*args)
self._setup_repo_type(repo_type)
self._setup_revset(revset)
repo_suffix = urllib.quote_plus(strip)
self.clone_path = os.path.join(REPOS_DIR, '.cache', '{}-partial-{}'.format(
repo_name, repo_suffix))
......@@ -284,14 +310,5 @@
repo_suffix = urllib.quote_plus(strip)
self.clone_path = os.path.join(REPOS_DIR, '.cache', '{}-partial-{}'.format(
repo_name, repo_suffix))
if revset is not None:
self.rev = self.hg('identify', '-i', '-r', revset).strip()
else:
self.rev = None
self.strip = strip
self.repo_type = repo_type
if repo_type == 'http':
self._hgserve = HgWeb()
self.hgport = self._hgserve.start(self.hgpath, self.environ)
def teardown(self, *args, **kwargs):
......@@ -296,7 +313,6 @@
def teardown(self, *args, **kwargs):
if self._hgserve is not None:
self._hgserve.stop()
self._teardown_repo_type()
class ExchangeTimeSuite(BaseExchangeTimeSuite):
......
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