@@ -260,7 +260,7 @@ def kms_factory(kms_connection_configuration):
260260 return InMemoryKmsClient (kms_connection_configuration )
261261
262262 crypto_factory = pq .CryptoFactory (kms_factory )
263- with pytest .raises (RuntimeError , match = r"column_keys" ):
263+ with pytest .raises (OSError , match = r"Either column_keys or uniform_encryption must be set " ):
264264 # Write with encryption properties
265265 write_encrypted_parquet (path , data_table , encryption_config ,
266266 kms_connection_config , crypto_factory )
@@ -281,7 +281,7 @@ def kms_factory(kms_connection_configuration):
281281 return InMemoryKmsClient (kms_connection_configuration )
282282
283283 crypto_factory = pq .CryptoFactory (kms_factory )
284- with pytest .raises (RuntimeError , match = "footer_key.*KeyError " ):
284+ with pytest .raises (KeyError , match = "footer_key" ):
285285 # Write with encryption properties
286286 write_encrypted_parquet (path , data_table , encryption_config ,
287287 kms_connection_config , crypto_factory )
@@ -316,8 +316,8 @@ def kms_factory(kms_connection_configuration):
316316 # Exception thrown in wrap/unwrap calls
317317 return ThrowingKmsClient (kms_connection_configuration )
318318
319- with pytest . raises ( RuntimeError , match = "Cannot Wrap Key.*ValueError" ):
320- crypto_factory = pq . CryptoFactory ( kms_factory )
319+ crypto_factory = pq . CryptoFactory ( kms_factory )
320+ with pytest . raises ( ValueError , match = "Cannot Wrap Key" ):
321321 # Write with encryption properties
322322 write_encrypted_parquet (path , data_table , encryption_config ,
323323 kms_connection_config , crypto_factory )
@@ -336,8 +336,8 @@ def kms_factory(kms_connection_configuration):
336336 raise ValueError ('Cannot create KmsClient' )
337337
338338 crypto_factory = pq .CryptoFactory (kms_factory )
339- with pytest .raises (RuntimeError ,
340- match = "Cannot create KmsClient.*ValueError " ):
339+ with pytest .raises (ValueError ,
340+ match = "Cannot create KmsClient" ):
341341 # Write with encryption properties
342342 write_encrypted_parquet (path , data_table , encryption_config ,
343343 kms_connection_config , crypto_factory )
@@ -370,7 +370,7 @@ def kms_factory(kms_connection_configuration):
370370 return WrongTypeKmsClient (kms_connection_configuration )
371371
372372 crypto_factory = pq .CryptoFactory (kms_factory )
373- with pytest .raises (RuntimeError , match = r" TypeError" ):
373+ with pytest .raises (TypeError ):
374374 # Write with encryption properties
375375 write_encrypted_parquet (path , data_table , encryption_config ,
376376 kms_connection_config , crypto_factory )
0 commit comments