(tmpdir)
| 2158 | |
| 2159 | |
| 2160 | def test_output_stream_destructor(tmpdir): |
| 2161 | # The wrapper returned by pa.output_stream() should respect Python |
| 2162 | # file semantics, i.e. destroying it should close the underlying |
| 2163 | # file cleanly. |
| 2164 | data = b"some test data\n" |
| 2165 | file_path = tmpdir / 'output_stream.buffered' |
| 2166 | |
| 2167 | def check_data(file_path, data, **kwargs): |
| 2168 | stream = pa.output_stream(file_path, **kwargs) |
| 2169 | stream.write(data) |
| 2170 | del stream |
| 2171 | gc.collect() |
| 2172 | with open(str(file_path), 'rb') as f: |
| 2173 | return f.read() |
| 2174 | |
| 2175 | assert check_data(file_path, data, buffer_size=0) == data |
| 2176 | assert check_data(file_path, data, buffer_size=1024) == data |
| 2177 | |
| 2178 | |
| 2179 | @pytest.mark.gzip |
nothing calls this directly
no test coverage detected