def test_multi_render(self):
    """Only one rendering instance allowed at a time."""
    if 'UNITTEST_IN_DOCKER' in os.environ:
      # Rendering is not supported.
      return
    cfg = config.Config({})
    env1 = football_env.FootballEnv(cfg)
    env1.render()
    env1.reset()

    env2 = football_env.FootballEnv(cfg)
    try:
      env2.render()
    except AssertionError:
      env1.close()
      env2.close()
      # It is still possible to render.
      env3 = football_env.FootballEnv(cfg)
      env3.reset()
      env3.close()
      return
    assert False, 'Exception expected'
Only one rendering instance allowed at a time.
gfootball/env/football_env_test.py