Skip to content

Commit c503450

Browse files
committed
Move no name test to pytest for coverage
1 parent 32581a1 commit c503450

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

tests/test_gzip_compliance.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -898,15 +898,3 @@ def test_decompress_cannot_have_flags_compression(self):
898898
b'-0/--fast',
899899
err)
900900
self.assertEqual(out, b'')
901-
902-
@create_and_remove_directory(TEMPDIR)
903-
def test_compress_no_name(self):
904-
args = sys.executable, '-m', 'isal.igzip', '-n'
905-
with Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE) as proc:
906-
out, err = proc.communicate(self.data)
907-
908-
self.assertEqual(err, b'')
909-
self.assertEqual(out[:2], b"\x1f\x8b")
910-
# Assert filename and mtime are not stored
911-
self.assertFalse(out[4] & gzip.FNAME)
912-
self.assertEqual(out[4:8], b"\x00\x00\x00\x00")

tests/test_igzip.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,21 @@ def test_compress_infile_out_file_inmplicit_name_prompt_accept(
222222
assert err == b""
223223

224224

225+
def test_compress_infile_out_file_no_name(tmp_path, capsysbinary):
226+
test = tmp_path / "test"
227+
test.write_bytes(DATA)
228+
out_file = tmp_path / "compressed.gz"
229+
sys.argv = ['', '-n', '-o', str(out_file), str(test)]
230+
igzip.main()
231+
out, err = capsysbinary.readouterr()
232+
output = out_file.read_bytes()
233+
assert gzip.decompress(output) == DATA
234+
assert err == b''
235+
assert out == b''
236+
assert output[4] & gzip.FNAME == 0 # No filename set.
237+
assert output[4:8] == b"\x00\x00\x00\x00" # No timestamp set.
238+
239+
225240
def test_decompress():
226241
assert igzip.decompress(COMPRESSED_DATA) == DATA
227242

0 commit comments

Comments
 (0)