def remove_replay_dump(request, replay_file) -> None:
    """Remove the replay file created by tests."""

    def fin_remove_replay_file() -> None:
        if os.path.exists(replay_file):
            os.remove(replay_file)

    request.addfinalizer(fin_remove_replay_file)
Remove the replay file created by tests.
tests/replay/test_dump.py