File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
opengrok-tools/src/test/python Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -175,25 +175,27 @@ def test_long_output():
175
175
"""
176
176
Test that output thread in the Command class captures all of the output.
177
177
(and also it does not hang the command by filling up the pipe)
178
+
179
+ By default stderr is redirected to stdout.
178
180
"""
179
181
# in bytes, should be enough to fill a pipe
180
- num_lines = 500
182
+ num_lines = 5000
181
183
line_length = 1000
184
+ num_bytes = num_lines * (line_length + 1 )
182
185
with tempfile .NamedTemporaryFile () as file :
183
186
for _ in range (num_lines ):
184
187
file .write (b'A' * line_length )
185
188
file .write (b'\n ' )
186
189
file .flush ()
187
- assert os .path .getsize (file .name ) == num_lines * ( line_length + 1 )
190
+ assert os .path .getsize (file .name ) == num_bytes
188
191
189
192
cmd = Command (["/bin/cat" , file .name ])
190
193
cmd .execute ()
191
194
192
195
assert cmd .getstate () == Command .FINISHED
193
196
assert cmd .getretcode () == 0
194
197
assert cmd .geterroutput () is None
195
- # -1 because getoutputstr() strips the string
196
- assert len (cmd .getoutputstr ()) == num_lines * (line_length + 1 ) - 1
198
+ assert len ("" .join (cmd .getoutput ())) == num_bytes
197
199
198
200
199
201
@pytest .mark .skipif (not os .name .startswith ("posix" ), reason = "requires posix" )
You can’t perform that action at this time.
0 commit comments