7
7
8
8
import pytest
9
9
from click .testing import CliRunner
10
- from hbutils .testing import cmdv
10
+ from hbutils .testing import cmdv , OS
11
11
12
12
from treevalue import FastTreeValue , dump , graphics
13
13
from treevalue .entry .cli import treevalue_cli
@@ -36,7 +36,8 @@ def test_simple_code_graph(self):
36
36
'-o' , 'test_graph.svg' , '-o' , 'test_graph.gv' ],
37
37
)
38
38
39
- assert result .exit_code == 0
39
+ assert result .exit_code == 0 , f'Runtime Error (exitcode { result .exit_code } ), ' \
40
+ f'The output is:\n { result .output } '
40
41
assert os .path .exists ('test_graph.svg' )
41
42
assert os .path .getsize ('test_graph.svg' ) <= 7000
42
43
assert os .path .exists ('test_graph.gv' )
@@ -52,7 +53,8 @@ def test_simple_code_graph_to_stdout(self):
52
53
'-o' , 'test_graph.svg' , '-o' , 'test_graph.gv' , '-O' ],
53
54
)
54
55
55
- assert result .exit_code == 0
56
+ assert result .exit_code == 0 , f'Runtime Error (exitcode { result .exit_code } ), ' \
57
+ f'The output is:\n { result .output } '
56
58
assert not os .path .exists ('test_graph.svg' )
57
59
assert not os .path .exists ('test_graph.gv' )
58
60
assert len (result .output ) <= 2500
@@ -66,7 +68,8 @@ def test_simple_code_multiple_graph(self):
66
68
args = ['graph' , '-t' , 'test.entry.cli.test_graph.t[12]' , '-o' , 'test_graph.svg' ],
67
69
)
68
70
69
- assert result .exit_code == 0
71
+ assert result .exit_code == 0 , f'Runtime Error (exitcode { result .exit_code } ), ' \
72
+ f'The output is:\n { result .output } '
70
73
assert os .path .exists ('test_graph.svg' )
71
74
assert os .path .getsize ('test_graph.svg' ) <= 13000
72
75
@@ -76,7 +79,8 @@ def test_simple_code_multiple_graph(self):
76
79
args = ['graph' , '-t' , 'test.entry.cli.test_graph.*' , '-o' , 'test_graph.svg' ],
77
80
)
78
81
79
- assert result .exit_code == 0
82
+ assert result .exit_code == 0 , f'Runtime Error (exitcode { result .exit_code } ), ' \
83
+ f'The output is:\n { result .output } '
80
84
assert os .path .exists ('test_graph.svg' )
81
85
assert os .path .getsize ('test_graph.svg' ) <= 17500
82
86
@@ -92,7 +96,8 @@ def test_simple_binary_graph(self):
92
96
args = ['graph' , '-t' , 'g1.bg' , '-o' , 'test_graph.svg' ],
93
97
)
94
98
95
- assert result .exit_code == 0
99
+ assert result .exit_code == 0 , f'Runtime Error (exitcode { result .exit_code } ), ' \
100
+ f'The output is:\n { result .output } '
96
101
assert os .path .exists ('test_graph.svg' )
97
102
assert os .path .getsize ('test_graph.svg' ) <= 6500
98
103
@@ -109,7 +114,8 @@ def test_simple_binary_graph(self):
109
114
args = ['graph' , '-t' , '*.bg' , '-o' , 'test_graph.svg' ],
110
115
)
111
116
112
- assert result .exit_code == 0
117
+ assert result .exit_code == 0 , f'Runtime Error (exitcode { result .exit_code } ), ' \
118
+ f'The output is:\n { result .output } '
113
119
assert os .path .exists ('test_graph.svg' )
114
120
assert os .path .getsize ('test_graph.svg' ) <= 17500
115
121
@@ -122,7 +128,8 @@ def test_simple_binary_graph(self):
122
128
args = ['graph' , '-t' , 'test.entry.cli.test_graph.t1' , '-o' , 'test_graph.svg' ],
123
129
)
124
130
125
- assert result .exit_code == 0
131
+ assert result .exit_code == 0 , f'Runtime Error (exitcode { result .exit_code } ), ' \
132
+ f'The output is:\n { result .output } '
126
133
assert os .path .exists ('test_graph.svg' )
127
134
assert os .path .getsize ('test_graph.svg' ) <= 13000
128
135
@@ -135,7 +142,8 @@ def test_simple_binary_graph(self):
135
142
args = ['graph' , '-t' , 'test.entry.cli.test_graph.t1' , '-o' , 'test_graph.svg' ],
136
143
)
137
144
138
- assert result .exit_code == 0
145
+ assert result .exit_code == 0 , f'Runtime Error (exitcode { result .exit_code } ), ' \
146
+ f'The output is:\n { result .output } '
139
147
assert os .path .exists ('test_graph.svg' )
140
148
assert os .path .getsize ('test_graph.svg' ) <= 6500
141
149
@@ -149,7 +157,8 @@ def test_duplicates(self):
149
157
'-o' , 'test_graph.svg' ],
150
158
)
151
159
152
- assert result .exit_code == 0
160
+ assert result .exit_code == 0 , f'Runtime Error (exitcode { result .exit_code } ), ' \
161
+ f'The output is:\n { result .output } '
153
162
assert os .path .exists ('test_graph.svg' )
154
163
assert os .path .getsize ('test_graph.svg' ) <= 12000
155
164
@@ -162,7 +171,8 @@ def test_duplicates(self):
162
171
'-o' , 'test_graph.svg' ],
163
172
)
164
173
165
- assert result .exit_code == 0
174
+ assert result .exit_code == 0 , f'Runtime Error (exitcode { result .exit_code } ), ' \
175
+ f'The output is:\n { result .output } '
166
176
assert os .path .exists ('test_graph.svg' )
167
177
import shutil
168
178
shutil .copy ('test_graph.svg' , os .path .join (_p , 'test_graph.svg' ))
@@ -179,7 +189,8 @@ def test_graph(self):
179
189
'-t' , 'first title' , '-o' , 'test_graph.svg' ],
180
190
)
181
191
182
- assert result .exit_code == 0
192
+ assert result .exit_code == 0 , f'Runtime Error (exitcode { result .exit_code } ), ' \
193
+ f'The output is:\n { result .output } '
183
194
assert os .path .exists ('test_graph.svg' )
184
195
assert os .path .getsize ('test_graph.svg' ) <= 16500
185
196
@@ -196,7 +207,8 @@ def test_cfg(self):
196
207
'-c' , 'bgcolor=#ffffff00' , '-O' ],
197
208
)
198
209
199
- assert result .exit_code == 0
210
+ assert result .exit_code == 0 , f'Runtime Error (exitcode { result .exit_code } ), ' \
211
+ f'The output is:\n { result .output } '
200
212
assert len (result .output ) <= 6000
201
213
assert '#ffffff00' in result .output
202
214
@@ -207,7 +219,9 @@ def test_cfg(self):
207
219
'-c' , 'bgcolor#ffffff00' , '-O' ],
208
220
)
209
221
210
- assert result .exit_code != 0
222
+ assert result .exit_code != 0 , f'The running expected to raise RuntimeError ' \
223
+ f'but not actually (exitcode { result .exit_code } ), ' \
224
+ f'The output is:\n { result .output } '
211
225
assert "Configuration should be KEY=VALUE, but 'bgcolor#ffffff00' found." in result .output
212
226
213
227
@unittest .skipUnless (cmdv ('dot' ), 'Dot installed only' )
@@ -227,6 +241,10 @@ def test_file_with_invalid_permission(self):
227
241
args = ['graph' , '-t' , 'g1.bg' , '-o' , 'test_graph.svg' ],
228
242
)
229
243
230
- assert result .exit_code == 0
244
+ assert result .exit_code == 0 , f'Runtime Error (exitcode { result .exit_code } ), ' \
245
+ f'The output is:\n { result .output } '
231
246
assert os .path .exists ('test_graph.svg' )
232
- assert os .path .getsize ('test_graph.svg' ) <= 1000
247
+ if OS .windows :
248
+ assert os .path .getsize ('test_graph.svg' ) <= 2000
249
+ else :
250
+ assert os .path .getsize ('test_graph.svg' ) <= 1000
0 commit comments