Skip to content
Snippets Groups Projects
Commit 91acabfefa62 authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

branching: merge with other head

No related branches found
No related tags found
No related merge requests found
...@@ -16,8 +16,13 @@ ...@@ -16,8 +16,13 @@
import urllib import urllib
import pipes import pipes
from .utils import (BaseNChangesetsTestSuite, BaseTestSuite, from .utils import (
median, REPOS_DIR) BaseNChangesetsTestSuite,
BaseTestSuite,
params_as_kwargs,
median,
REPOS_DIR
)
if sys.version_info[0] == 2: if sys.version_info[0] == 2:
import Queue as queue import Queue as queue
...@@ -40,5 +45,9 @@ ...@@ -40,5 +45,9 @@
timeout = 120 timeout = 120
def track_commit(self, *args, **kwargs): params = BaseTestSuite.params + [("create", "update")]
param_names = BaseTestSuite.param_names + ["mode"]
@params_as_kwargs
def track_commit(self, mode, **kwargs):
timings = [] timings = []
...@@ -44,2 +53,3 @@ ...@@ -44,2 +53,3 @@
timings = [] timings = []
filename = None
...@@ -45,5 +55,12 @@ ...@@ -45,5 +55,12 @@
with open(os.path.join(self.repo_path, 'BABAR'), 'w') as f: self.hg('status')
f.write("BABAR")
if mode == 'create':
with open(os.path.join(self.repo_path, 'BABAR'), 'w') as f:
f.write("BABAR")
else:
# pick filename to update
filename = self.hg('manifest').partition('\n')[0]
filename = os.path.join(self.repo_path, filename)
# Do the commits N time # Do the commits N time
...@@ -48,4 +65,4 @@ ...@@ -48,4 +65,4 @@
# Do the commits N time # Do the commits N time
for i in range(3): for i in range(10):
try: try:
...@@ -51,2 +68,9 @@ ...@@ -51,2 +68,9 @@
try: try:
if mode == 'update':
with open(filename, 'a') as target:
target.write(
'The quick brown fox jumps over the lazy dog\n')
else:
self.hg('add', 'BABAR')
before = time.time() before = time.time()
...@@ -52,8 +76,8 @@ ...@@ -52,8 +76,8 @@
before = time.time() before = time.time()
self.hg('commit', '-A', '-m', 'My commit message', self.hg('commit', '-m', 'My commit message',
'-u', '<test@octobus.net>') '-u', '<test@octobus.net>')
after = time.time() after = time.time()
timings.append(after - before) timings.append(after - before)
finally: finally:
# Rollback and clean # Rollback and clean
self.hg('rollback', '--config', 'ui.rollback=true') self.hg('rollback', '--config', 'ui.rollback=true')
...@@ -54,9 +78,10 @@ ...@@ -54,9 +78,10 @@
'-u', '<test@octobus.net>') '-u', '<test@octobus.net>')
after = time.time() after = time.time()
timings.append(after - before) timings.append(after - before)
finally: finally:
# Rollback and clean # Rollback and clean
self.hg('rollback', '--config', 'ui.rollback=true') self.hg('rollback', '--config', 'ui.rollback=true')
self.hg('debugupdatecache')
self.hg('update', '-C', '.') self.hg('update', '-C', '.')
return median(timings) return median(timings)
......
from __future__ import print_function from __future__ import print_function
import json import json
import functools
import os import os
import os.path import os.path
import re import re
...@@ -115,6 +116,22 @@ ...@@ -115,6 +116,22 @@
return sum(sorted(lst)[quotient - 1:quotient + 1]) / 2. return sum(sorted(lst)[quotient - 1:quotient + 1]) / 2.
def params_as_kwargs(f):
"""Pass in test parameters as keyword arguments.
Use as a decorator on BaseTestSuite methods
"""
@functools.wraps(f)
def wrapper(self, *args, **kwargs):
names = self.param_names
args, values = args[len(names):], args[:len(names)]
kwargs.update(zip(names, values))
return f(self, *args, **kwargs)
return wrapper
class BaseTestSuite(object): class BaseTestSuite(object):
params = [REPOS] params = [REPOS]
......
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