(tmp_path: Path, compressor: CliCompressor)
| 43 | |
| 44 | @pytest.mark.parametrize('compressor', KNOWN_COMPRESSORS) |
| 45 | def test_compressor(tmp_path: Path, compressor: CliCompressor) -> None: |
| 46 | if not compressor.exists: |
| 47 | pytest.skip(reason=f'compressor {compressor.cmd} not found') |
| 48 | |
| 49 | test_file = tmp_path / f'my_file.{compressor.extension}' |
| 50 | test_data = b'foo foo foo' |
| 51 | |
| 52 | with compressor.compress(str(test_file)) as f: |
| 53 | f.write(test_data) |
| 54 | assert test_file.exists() |
| 55 | assert test_file.read_bytes() != test_data |
| 56 | |
| 57 | with compressor.decompress(str(test_file)) as f: |
| 58 | decompressed = f.read() |
| 59 | assert decompressed == test_data |
nothing calls this directly
no test coverage detected