(tmpdir)
| 2183 | |
| 2184 | |
| 2185 | def test_output_stream_destructor(tmpdir): |
| 2186 | # The wrapper returned by pa.output_stream() should respect Python |
| 2187 | # file semantics, i.e. destroying it should close the underlying |
| 2188 | # file cleanly. |
| 2189 | data = b"some test data\n" |
| 2190 | file_path = tmpdir / 'output_stream.buffered' |
| 2191 | |
| 2192 | def check_data(file_path, data, **kwargs): |
| 2193 | stream = pa.output_stream(file_path, **kwargs) |
| 2194 | stream.write(data) |
| 2195 | del stream |
| 2196 | gc.collect() |
| 2197 | with open(str(file_path), 'rb') as f: |
| 2198 | return f.read() |
| 2199 | |
| 2200 | assert check_data(file_path, data, buffer_size=0) == data |
| 2201 | assert check_data(file_path, data, buffer_size=1024) == data |
| 2202 | |
| 2203 | |
| 2204 | @pytest.mark.gzip |
nothing calls this directly
no test coverage detected