##// END OF EJS Templates
tests: add filtercr.py helper for progress tests...
Martin Geisler -
r13141:6cfe17c1 default
parent child Browse files
Show More
@@ -0,0 +1,10 b''
1 #!/usr/bin/env python
2
3 # Filter output by the progress extension to make it readable in tests
4
5 import sys, re
6
7 for line in sys.stdin:
8 line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line)
9 sys.stdout.write(line)
10 print
@@ -169,14 +169,8 b" Test convert progress bar'"
169 169 > delay = 0
170 170 > refresh = 0
171 171 > EOF
172 $ cat > filtercr.py <<EOF
173 > import sys, re
174 > for line in sys.stdin:
175 > line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line)
176 > sys.stdout.write(line)
177 > EOF
178 172
179 $ hg convert svn-repo hg-progress 2>&1 | python filtercr.py
173 $ hg convert svn-repo hg-progress 2>&1 | $TESTDIR/filtercr.py
180 174
181 175 scanning [ <=> ] 1
182 176 scanning [ <=> ] 2
@@ -249,3 +243,4 b" Test convert progress bar'"
249 243 2 adddb
250 244 1 branch
251 245 0 clobberdir
246
@@ -23,14 +23,6 b''
23 23 > }
24 24 > EOF
25 25
26 $ cat > filtercr.py <<EOF
27 > import sys, re
28 > for line in sys.stdin:
29 > line = re.sub(r'\r+[^\n]', lambda m: '\n' + m.group()[-1:], line)
30 > sys.stdout.write(line)
31 > print
32 > EOF
33
34 26 $ echo "[extensions]" >> $HGRCPATH
35 27 $ echo "progress=" >> $HGRCPATH
36 28 $ echo "loop=`pwd`/loop.py" >> $HGRCPATH
@@ -39,14 +31,14 b''
39 31
40 32 test default params, display nothing because of delay
41 33
42 $ hg -y loop 3 2>&1 | python filtercr.py
34 $ hg -y loop 3 2>&1 | $TESTDIR/filtercr.py
43 35
44 36 $ echo "delay=0" >> $HGRCPATH
45 37 $ echo "refresh=0" >> $HGRCPATH
46 38
47 39 test with delay=0, refresh=0
48 40
49 $ hg -y loop 3 2>&1 | python filtercr.py
41 $ hg -y loop 3 2>&1 | $TESTDIR/filtercr.py
50 42
51 43 loop [ ] 0/3
52 44 loop [=====================> ] 1/3
@@ -55,12 +47,13 b' test with delay=0, refresh=0'
55 47
56 48 test refresh is taken in account
57 49
58 $ hg -y --config progress.refresh=100 loop 3 2>&1 | python filtercr.py
50 $ hg -y --config progress.refresh=100 loop 3 2>&1 | $TESTDIR/filtercr.py
59 51
60 52
61 53 test format options 1
62 54
63 $ hg -y --config 'progress.format=number topic item+2' loop 2 2>&1 | python filtercr.py
55 $ hg -y --config 'progress.format=number topic item+2' loop 2 2>&1 \
56 > | $TESTDIR/filtercr.py
64 57
65 58 0/2 loop lo
66 59 1/2 loop lo
@@ -68,7 +61,8 b' test format options 1'
68 61
69 62 test format options 2
70 63
71 $ hg -y --config 'progress.format=number item-3 bar' loop 2 2>&1 | python filtercr.py
64 $ hg -y --config 'progress.format=number item-3 bar' loop 2 2>&1 \
65 > | $TESTDIR/filtercr.py
72 66
73 67 0/2 p.0 [ ]
74 68 1/2 p.1 [=================================> ]
@@ -76,7 +70,8 b' test format options 2'
76 70
77 71 test format options and indeterminate progress
78 72
79 $ hg -y --config 'progress.format=number item bar' loop -- -2 2>&1 | python filtercr.py
73 $ hg -y --config 'progress.format=number item bar' loop -- -2 2>&1 \
74 > | $TESTDIR/filtercr.py
80 75
81 76 0 loop.0 [ <=> ]
82 77 1 loop.1 [ <=> ]
@@ -84,7 +79,7 b' test format options and indeterminate pr'
84 79
85 80 make sure things don't fall over if count > total
86 81
87 $ hg -y loop --total 4 6 2>&1 | python filtercr.py
82 $ hg -y loop --total 4 6 2>&1 | $TESTDIR/filtercr.py
88 83
89 84 loop [ ] 0/4
90 85 loop [================> ] 1/4
@@ -96,5 +91,5 b" make sure things don't fall over if coun"
96 91
97 92 test immediate progress completion
98 93
99 $ hg -y loop 0 2>&1 | python filtercr.py
94 $ hg -y loop 0 2>&1 | $TESTDIR/filtercr.py
100 95
General Comments 0
You need to be logged in to leave comments. Login now