@@ -75,15 +75,26 @@ def test_threaded_read_error():
75
75
tr_f .read ()
76
76
77
77
78
+ @pytest .mark .timeout (5 )
79
+ @pytest .mark .parametrize ("threads" , [1 , 3 ])
80
+ def test_threaded_write_oversized_block_no_error (threads ):
81
+ with igzip_threaded .open (
82
+ io .BytesIO (), "wb" , compresslevel = 3 , threads = threads ,
83
+ block_size = 8 * 1024
84
+ ) as writer :
85
+ writer .write (os .urandom (1024 * 64 ))
86
+
87
+
78
88
@pytest .mark .timeout (5 )
79
89
@pytest .mark .parametrize ("threads" , [1 , 3 ])
80
90
def test_threaded_write_error (threads ):
81
- # parallel_deflate_and_crc method is called in a worker thread.
91
+ f = igzip_threaded ._ThreadedGzipWriter (
92
+ fp = io .BytesIO (), level = 3 ,
93
+ threads = threads , buffer_size = 8 * 1024 )
94
+ # Bypass the write method which should not allow this.
95
+ f .input_queues [0 ].put ((os .urandom (1024 * 64 ), b"" ))
82
96
with pytest .raises (OverflowError ) as error :
83
- with igzip_threaded .open (
84
- io .BytesIO (), "wb" , compresslevel = 3 , threads = threads
85
- ) as writer :
86
- writer .write (os .urandom (1024 * 1024 * 50 ))
97
+ f .close ()
87
98
error .match ("Compressed output exceeds buffer size" )
88
99
89
100
0 commit comments