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

Augie Fackler durin42 at gmail.com
Tue Dec 14 17:32:29 CST 2010


# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1292368575 21600
# Node ID 4af11c87ae56a04c0bf2c149fbe62e8f2f246c8d
# Parent  0f652ea645ab7393dfdc507165f61b853fd6e092
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
@@ -98,3 +98,46 @@
 
   $ hg -y loop 0 2>&1 | python 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
+
+  $ hg -y loop 8 2>&1 | python filtercr.py
+  
+  loop [                                                                    ] 0/4
+  loop [==============>                                               ] 1/4 1m07s
+  loop [===============================>                                ] 2/4 45s
+  loop [===============================================>                ] 3/4 23s
+                                                                                  \r (esc)
+
+  $ MOCKTIME=10000 hg -y loop 4 2>&1 | python 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