##// 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 > delay = 0
169 > delay = 0
170 > refresh = 0
170 > refresh = 0
171 > EOF
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 scanning [ <=> ] 1
175 scanning [ <=> ] 1
182 scanning [ <=> ] 2
176 scanning [ <=> ] 2
@@ -249,3 +243,4 b" Test convert progress bar'"
249 2 adddb
243 2 adddb
250 1 branch
244 1 branch
251 0 clobberdir
245 0 clobberdir
246
@@ -23,14 +23,6 b''
23 > }
23 > }
24 > EOF
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 $ echo "[extensions]" >> $HGRCPATH
26 $ echo "[extensions]" >> $HGRCPATH
35 $ echo "progress=" >> $HGRCPATH
27 $ echo "progress=" >> $HGRCPATH
36 $ echo "loop=`pwd`/loop.py" >> $HGRCPATH
28 $ echo "loop=`pwd`/loop.py" >> $HGRCPATH
@@ -39,14 +31,14 b''
39
31
40 test default params, display nothing because of delay
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 $ echo "delay=0" >> $HGRCPATH
36 $ echo "delay=0" >> $HGRCPATH
45 $ echo "refresh=0" >> $HGRCPATH
37 $ echo "refresh=0" >> $HGRCPATH
46
38
47 test with delay=0, refresh=0
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 loop [ ] 0/3
43 loop [ ] 0/3
52 loop [=====================> ] 1/3
44 loop [=====================> ] 1/3
@@ -55,12 +47,13 b' test with delay=0, refresh=0'
55
47
56 test refresh is taken in account
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 test format options 1
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 0/2 loop lo
58 0/2 loop lo
66 1/2 loop lo
59 1/2 loop lo
@@ -68,7 +61,8 b' test format options 1'
68
61
69 test format options 2
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 0/2 p.0 [ ]
67 0/2 p.0 [ ]
74 1/2 p.1 [=================================> ]
68 1/2 p.1 [=================================> ]
@@ -76,7 +70,8 b' test format options 2'
76
70
77 test format options and indeterminate progress
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 0 loop.0 [ <=> ]
76 0 loop.0 [ <=> ]
82 1 loop.1 [ <=> ]
77 1 loop.1 [ <=> ]
@@ -84,7 +79,7 b' test format options and indeterminate pr'
84
79
85 make sure things don't fall over if count > total
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 loop [ ] 0/4
84 loop [ ] 0/4
90 loop [================> ] 1/4
85 loop [================> ] 1/4
@@ -96,5 +91,5 b" make sure things don't fall over if coun"
96
91
97 test immediate progress completion
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