code: def pytest_generate_tests(metafunc):
      """Generate parameter permutations for selected test functions:
  
      * :func:`test_valid_base_estimator`
      * :func:`test_invalid_base_estimator`
  
      Test function parametrization is performed using the module-level variable `EST_OPT_PRO_PAIRS`,
      which is a dict, with a key for each OptimizationProtocol. The value of each key is a dict,
      formatted thusly::
          "est": [<valid `base_estimator` for OptPro>, ...],
          "opt": [<OptPro class>, ...]
  
      Each value of `EST_OPT_PRO_PAIRS`, therefore, defines valid `base_estimator` values for the
      corresponding OptimizationProtocol class(es)
  
      Notes
      -----
      Although it's an official (and awesome) PyTest feature, `pytest_generate_tests` is not terribly
      well-known and seems a bit black-magic-y, so instead of leaving curious readers to do their own
      research, I humbly recommend the following PyTest examples:
  
      * `Basic "pytest_generate_tests" example
        <https://docs.pytest.org/en/latest/parametrize.html#basic-pytest-generate-tests-example>`_
      * `A quick port of "testscenarios"
        <https://docs.pytest.org/en/latest/example/parametrize.html#a-quick-port-of-testscenarios>`_
      """
      arg_names, arg_values, id_list = None, [], []
  
      # Only parametrize test functions explicitly named - Return other test functions unchanged
      if metafunc.function.__name__ == "test_valid_base_estimator":
          scenarios = EST_OPT_PRO_PAIRS
      elif metafunc.function.__name__ == "test_invalid_base_estimator":
          scenarios = {
              k: dict(est=est_except(k), opt=v["opt"])
              for k, v in EST_OPT_PRO_PAIRS.items()
          }
      else:
          return
  
      # Parametrize functions using `scenarios`
      for id_prefix, scenario_dict in scenarios.items():
          arg_names = list(scenario_dict.keys())
  
          for est in scenario_dict["est"]:
              for opt in scenario_dict["opt"]:
                  arg_values.append((est, opt))
                  e = (
                      est
                      if isinstance(est, str)
                      else est.__class__.__name__
                  )
                  id_list.append(f"{id_prefix}({e}, {opt.__name__})")
  
      metafunc.parametrize(
          arg_names, arg_values, ids=id_list, scope="function"
      )
  
imports: from hyperparameter_hunter import Environment
  from hyperparameter_hunter import settings
  from hyperparameter_hunter.i_o.exceptions import EnvironmentInactiveError, EnvironmentInvalidError
  from hyperparameter_hunter.optimization.backends.skopt import protocols
  from hyperparameter_hunter.utils.general_utils import flatten, subdict
  from hyperparameter_hunter.utils.learning_utils import get_toy_classification_data
  import pytest
  from unittest import mock
  from sklearn.linear_model import Ridge
  from skopt.learning.gaussian_process.gpr import GaussianProcessRegressor
  from skopt.learning.gbrt import GradientBoostingQuantileRegressor
  from skopt.learning.forest import RandomForestRegressor, ExtraTreesRegressor
label_desc: Use image node_id 4 for calling a global function with example usage: pytest_generate_tests(metafunc) without return types