def METHOD_NAME():
    """Test if argument video_length of RecordVideo works properly."""
    env = gym.make("CartPole-v1", render_mode="rgb_array_list")
    env._max_episode_steps = 20
    env = RecordVideoV0(env, "videos", step_trigger=lambda x: x == 0, video_length=10)
    env.reset()
    for _ in range(10):
        action = env.action_space.sample()
        env.step(action)
    assert env.recording
    action = env.action_space.sample()
    env.step(action)
    assert not env.recording
    env.close()
    assert os.path.isdir("videos")
    mp4_files = [file for file in os.listdir("videos") if file.endswith(".mp4")]
    assert len(mp4_files) == 1
    shutil.rmtree("videos")