code: def test_too_many_consecutive_failures(tmp_path):
      oracle = OracleStub(
          directory=tmp_path,
          objective="val_loss",
          max_retries_per_trial=2,
      )
  
      with pytest.raises(
          RuntimeError, match="Number of consecutive"
      ) as e:
          for _ in range(3):
              trial = oracle.create_trial(tuner_id="a")
              # Failed, so no retry.
              trial.status = trial_module.TrialStatus.FAILED
              trial.message = "custom_error_info"
              oracle.end_trial(trial)
          assert "custom_error_info" in str(e)
  
imports: import datetime
  import threading
  import time
  import numpy
  import pytest
  import keras_tuner
  from keras_tuner.engine import oracle
  from keras_tuner.engine import trial
  from keras_tuner.tuners import gridsearch
label_desc: Use image node_id 17 for calling a global function with example usage: test_too_many_consecutive_failures(tmp_path) without return types