def test_determinism_reset(n_scenarios, seed, expert_driving, force_step) -> list:
    """
    Runs same scenario n time and collects the traces
    """

    traces = []
    try:
        env = MetaDriveEnv(config={"map": "C", "num_scenarios": n_scenarios})

        for rep in range(n_scenarios):

            obs, step_info = env.reset(seed)
            step_info["repetition"] = rep
            traces.append(step_info)
            print(f"{env.current_seed = }")
            step = 0

            while True:
                # get action from expert driving, or a dummy action

                if step >= force_step:
                    break

                if expert_driving:
                    action, exp_obs = expert(env.agent, deterministic=True, need_obs=True)
                else:
                    action = [0, 0.33]

                obs, reward, tm, tr, step_info = env.step(action)
                step_info["repetition"] = rep
                traces.append(step_info)

                step += 1

                if tm or tr:
                    break

    finally:
        env.close()

    are_traces_deterministic(traces)
    return traces

    Runs same scenario n time and collects the traces
    
metadrive/tests/test_functionality/test_nondeterminism.py