[PATCH 1 of 5] test-progress: test completion estimates and progress bar delay

Augie Fackler durin42 at gmail.com
Wed Dec 15 11:25:33 CST 2010


# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1292433632 21600
# Node ID ce4cd176634e800fd5663fd4ab5691553bdb0be8
# Parent  aae2d5cbde647da49fb1927d02faabfc37975c63
test-progress: test completion estimates and progress bar delay

diff --git a/tests/test-progress.t b/tests/test-progress.t
--- a/tests/test-progress.t
+++ b/tests/test-progress.t
@@ -94,3 +94,49 @@
 
   $ hg -y loop 0 2>&1 | $TESTDIR/filtercr.py
   
+
+test delay time estimates
+
+  $ cat > mocktime.py <<EOF
+  > import os
+  > import time
+  > 
+  > class mocktime(object):
+  >     def __init__(self, increment):
+  >         self.time = 0
+  >         self.increment = increment
+  >     def __call__(self):
+  >         self.time += self.increment
+  >         return self.time
+  > 
+  > def uisetup(ui):
+  >     time.time = mocktime(int(os.environ.get('MOCKTIME', '11')))
+  > EOF
+
+  $ echo "[extensions]" > $HGRCPATH
+  $ echo "mocktime=`pwd`/mocktime.py" >> $HGRCPATH
+  $ echo "progress=" >> $HGRCPATH
+  $ echo "loop=`pwd`/loop.py" >> $HGRCPATH
+  $ echo "[progress]" >> $HGRCPATH
+  $ echo "assume-tty=1" >> $HGRCPATH
+  $ echo "delay=25" >> $HGRCPATH
+  $ echo "width=60" >> $HGRCPATH
+
+  $ hg -y loop 8 2>&1 | python $TESTDIR/filtercr.py
+  
+  loop [=========>                                ] 2/8 1m07s
+  loop [===============>                            ] 3/8 56s
+  loop [=====================>                      ] 4/8 45s
+  loop [==========================>                 ] 5/8 34s
+  loop [================================>           ] 6/8 23s
+  loop [=====================================>      ] 7/8 12s
+                                                              \r (esc)
+
+  $ MOCKTIME=10000 hg -y loop 4 2>&1 | python $TESTDIR/filtercr.py
+  
+  loop [                                                ] 0/4
+  loop [=========>                                ] 1/4 8h21m
+  loop [====================>                     ] 2/4 5h34m
+  loop [==============================>           ] 3/4 2h47m
+                                                              \r (esc)
+


More information about the Mercurial-devel mailing list