Show More
@@ -0,0 +1,18 b'' | |||||
|
1 | from __future__ import absolute_import | |||
|
2 | ||||
|
3 | import os | |||
|
4 | import time | |||
|
5 | ||||
|
6 | class mocktime(object): | |||
|
7 | def __init__(self, increment): | |||
|
8 | self.time = 0 | |||
|
9 | self.increment = [float(s) for s in increment.split()] | |||
|
10 | self.pos = 0 | |||
|
11 | ||||
|
12 | def __call__(self): | |||
|
13 | self.time += self.increment[self.pos % len(self.increment)] | |||
|
14 | self.pos += 1 | |||
|
15 | return self.time | |||
|
16 | ||||
|
17 | def uisetup(ui): | |||
|
18 | time.time = mocktime(os.environ.get('MOCKTIME', '0.1')) |
@@ -323,7 +323,8 b" Test breaking format changes aren't" | |||||
323 | $ hg email -m test.mbox -f quux -t foo -c bar -s test 0:tip \ |
|
323 | $ hg email -m test.mbox -f quux -t foo -c bar -s test 0:tip \ | |
324 | > --config extensions.progress= --config progress.assume-tty=1 \ |
|
324 | > --config extensions.progress= --config progress.assume-tty=1 \ | |
325 | > --config progress.delay=0 --config progress.refresh=0 \ |
|
325 | > --config progress.delay=0 --config progress.refresh=0 \ | |
326 | > --config progress.width=60 |
|
326 | > --config progress.width=60 \ | |
|
327 | > --config extensions.mocktime=$TESTDIR/mocktime.py | |||
327 | this patch series consists of 2 patches. |
|
328 | this patch series consists of 2 patches. | |
328 |
|
329 | |||
329 |
|
330 |
@@ -185,27 +185,9 b' test delay time estimates' | |||||
185 |
|
185 | |||
186 | #if no-chg |
|
186 | #if no-chg | |
187 |
|
187 | |||
188 | $ cat > mocktime.py <<EOF |
|
|||
189 | > import os |
|
|||
190 | > import time |
|
|||
191 | > |
|
|||
192 | > class mocktime(object): |
|
|||
193 | > def __init__(self, increment): |
|
|||
194 | > self.time = 0 |
|
|||
195 | > self.increment = [int(s) for s in increment.split()] |
|
|||
196 | > self.pos = 0 |
|
|||
197 | > def __call__(self): |
|
|||
198 | > self.time += self.increment[self.pos % len(self.increment)] |
|
|||
199 | > self.pos += 1 |
|
|||
200 | > return self.time |
|
|||
201 | > |
|
|||
202 | > def uisetup(ui): |
|
|||
203 | > time.time = mocktime(os.environ.get('MOCKTIME', '11')) |
|
|||
204 | > EOF |
|
|||
205 |
|
||||
206 | $ cp $HGRCPATH.orig $HGRCPATH |
|
188 | $ cp $HGRCPATH.orig $HGRCPATH | |
207 | $ echo "[extensions]" >> $HGRCPATH |
|
189 | $ echo "[extensions]" >> $HGRCPATH | |
208 |
$ echo "mocktime= |
|
190 | $ echo "mocktime=$TESTDIR/mocktime.py" >> $HGRCPATH | |
209 | $ echo "progress=" >> $HGRCPATH |
|
191 | $ echo "progress=" >> $HGRCPATH | |
210 | $ echo "loop=`pwd`/loop.py" >> $HGRCPATH |
|
192 | $ echo "loop=`pwd`/loop.py" >> $HGRCPATH | |
211 | $ echo "[progress]" >> $HGRCPATH |
|
193 | $ echo "[progress]" >> $HGRCPATH | |
@@ -213,7 +195,7 b' test delay time estimates' | |||||
213 | $ echo "delay=25" >> $HGRCPATH |
|
195 | $ echo "delay=25" >> $HGRCPATH | |
214 | $ echo "width=60" >> $HGRCPATH |
|
196 | $ echo "width=60" >> $HGRCPATH | |
215 |
|
197 | |||
216 | $ hg -y loop 8 |
|
198 | $ MOCKTIME=11 hg -y loop 8 | |
217 | \r (no-eol) (esc) |
|
199 | \r (no-eol) (esc) | |
218 | loop [=========> ] 2/8 1m07s\r (no-eol) (esc) |
|
200 | loop [=========> ] 2/8 1m07s\r (no-eol) (esc) | |
219 | loop [===============> ] 3/8 56s\r (no-eol) (esc) |
|
201 | loop [===============> ] 3/8 56s\r (no-eol) (esc) | |
@@ -274,7 +256,7 b' Non-linear progress:' | |||||
274 | \r (no-eol) (esc) |
|
256 | \r (no-eol) (esc) | |
275 |
|
257 | |||
276 | Time estimates should not fail when there's no end point: |
|
258 | Time estimates should not fail when there's no end point: | |
277 | $ hg -y loop -- -4 |
|
259 | $ MOCKTIME=11 hg -y loop -- -4 | |
278 | \r (no-eol) (esc) |
|
260 | \r (no-eol) (esc) | |
279 | loop [ <=> ] 2\r (no-eol) (esc) |
|
261 | loop [ <=> ] 2\r (no-eol) (esc) | |
280 | loop [ <=> ] 3\r (no-eol) (esc) |
|
262 | loop [ <=> ] 3\r (no-eol) (esc) |
General Comments 0
You need to be logged in to leave comments.
Login now