code: def test_envs_pass_env_checker(spec):
      """Check that all environments pass the environment checker with no warnings other than the expected."""
      with warnings.catch_warnings(record=True) as caught_warnings:
          env = spec.make(disable_env_checker=True).unwrapped
          check_env(env)
  
          env.close()
  
      for warning in caught_warnings:
          if warning.message.args[0] not in CHECK_ENV_IGNORE_WARNINGS:
              raise gym.error.Error(
                  f"Unexpected warning: {warning.message}"
              )
  
file_path: gym/tests/envs/test_envs.py
imports: import pickle
  import warnings
  import numpy
  import pytest
  import gym
  from gym.envs.registration import EnvSpec
  from gym.logger import warn
  from gym.utils.env_checker import check_env, data_equivalence
  from tests.envs.utils import all_testing_env_specs, all_testing_initialised_envs, assert_equals
label_desc: Use image node_id 1 for calling a global function with example usage: test_envs_pass_env_checker(spec) without return types