@@ -264,7 +264,7 @@ def __init__(
264
264
attr .validate (self )
265
265
266
266
@classmethod
267
- def from_scenario (
267
+ def from_scenario ( # noqa: C901
268
268
cls ,
269
269
scenario , # type: DECRYPT_SCENARIO_SPEC
270
270
plaintext_reader , # type: Callable[[str], bytes]
@@ -273,7 +273,7 @@ def from_scenario(
273
273
keyrings , # type: bool
274
274
keys_uri , # type: str
275
275
):
276
- # pylint: disable=too-many-locals
276
+ # pylint: disable=too-many-locals,too-many-branches
277
277
# type: (...) -> MessageDecryptionTestScenario
278
278
"""Load from a scenario specification.
279
279
@@ -330,11 +330,16 @@ def master_key_provider_fn():
330
330
# If unspecified, set "Default" as the default
331
331
cmm_type = "Default"
332
332
333
- # If this scenario does not have any key providers,
334
- # do not create a scenario.
335
- # Caller logic should expect `None` to mean "no scenario".
336
- if master_key_provider_fn () is None :
337
- return None
333
+ try :
334
+ # If this scenario does not have any key providers,
335
+ # do not create a scenario.
336
+ # Caller logic should expect `None` to mean "no scenario".
337
+ if master_key_provider_fn () is None :
338
+ return None
339
+ except Exception : # nosec,pylint: disable=broad-except
340
+ # If there is any exception when loading the key, continue to create the test scenario.
341
+ # Some test scenarios have bad keys that should fail during the test execution.
342
+ pass
338
343
339
344
return cls (
340
345
ciphertext_uri = scenario ["ciphertext" ],
0 commit comments