@@ -25,6 +25,7 @@ def setUp(self):
2525 )
2626
2727 def test_jpeg_rgb (self ):
28+ pytest .importorskip ("libjpeg" )
2829 filepath = str (self ._test_files_dir .joinpath ('frame_rgb.jpeg' ))
2930 with open (filepath , 'br' ) as fp :
3031 compressed_frame = fp .read ()
@@ -70,6 +71,7 @@ def test_jpeg_rgb(self):
7071 )
7172
7273 def test_jpeg_rgb_empty (self ):
74+ pytest .importorskip ("libjpeg" )
7375 filepath = str (self ._test_files_dir .joinpath ('frame_rgb_empty.jpeg' ))
7476 with open (filepath , 'br' ) as fp :
7577 compressed_frame = fp .read ()
@@ -161,6 +163,7 @@ def test_jpeg_monochrome(self):
161163 assert compressed_frame .endswith (b'\xFF \xD9 ' )
162164
163165 def test_jpeg2000_rgb (self ):
166+ pytest .importorskip ("openjpeg" )
164167 bits_allocated = 8
165168 frame = np .ones ((48 , 32 , 3 ), dtype = np .dtype (f'uint{ bits_allocated } ' ))
166169 frame [2 :4 , 5 :30 , 0 ] = 7
@@ -190,6 +193,7 @@ def test_jpeg2000_rgb(self):
190193 np .testing .assert_allclose (frame , decoded_frame , atol = 2 )
191194
192195 def test_jpeg2000_monochrome (self ):
196+ pytest .importorskip ("openjpeg" )
193197 bits_allocated = 8
194198 frame = np .zeros ((48 , 32 ), dtype = np .dtype (f'uint{ bits_allocated } ' ))
195199 frame [2 :4 , 5 :30 ] = 7
@@ -218,6 +222,7 @@ def test_jpeg2000_monochrome(self):
218222 np .testing .assert_allclose (frame , decoded_frame , atol = 2 )
219223
220224 def test_jpeg2000lossless_rgb (self ):
225+ pytest .importorskip ("openjpeg" )
221226 bits_allocated = 8
222227 frame = np .ones ((48 , 32 , 3 ), dtype = np .dtype (f'uint{ bits_allocated } ' ))
223228 frame *= 255
@@ -247,6 +252,7 @@ def test_jpeg2000lossless_rgb(self):
247252 np .testing .assert_array_equal (frame , decoded_frame )
248253
249254 def test_jpeg2000lossless_monochrome (self ):
255+ pytest .importorskip ("openjpeg" )
250256 bits_allocated = 16
251257 frame = np .zeros ((48 , 32 ), dtype = np .dtype (f'uint{ bits_allocated } ' ))
252258 compressed_frame = encode_frame (
@@ -274,6 +280,7 @@ def test_jpeg2000lossless_monochrome(self):
274280 np .testing .assert_array_equal (frame , decoded_frame )
275281
276282 def test_jpeg2000lossless_single_bit (self ):
283+ pytest .importorskip ("openjpeg" )
277284 bits_allocated = 1
278285 frame = np .zeros ((48 , 32 ), dtype = np .dtype ('uint8' ))
279286 frame [12 :45 , 3 :6 ] = 1
0 commit comments