From 419363c97a59e4a0533c2bd55848cfe266425f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20R=C4=85czy?= Date: Tue, 8 Apr 2025 15:25:25 -0700 Subject: [PATCH] Make it work --- selfdrive/test/process_replay/test_log_compat.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/selfdrive/test/process_replay/test_log_compat.py b/selfdrive/test/process_replay/test_log_compat.py index db6ca74573..cfc75b34a4 100644 --- a/selfdrive/test/process_replay/test_log_compat.py +++ b/selfdrive/test/process_replay/test_log_compat.py @@ -17,9 +17,11 @@ TARGET_BRANCH = os.environ.get("TARGET_BRANCH", "master") @pytest.fixture(scope="module") def parent_schema_file(tmp_path_factory): + tmp_dir = tmp_path_factory.mktemp("cereal") + shutil.copytree(CEREAL_PATH, tmp_dir, dirs_exist_ok=True) + commit = run_cmd(["git", "merge-base", f"{TARGET_REMOTE}/{TARGET_BRANCH}", "HEAD"]) log_capnp_url = f"https://raw.githubusercontent.com/commaai/openpilot/{commit}/cereal/log.capnp" - tmp_dir = tmp_path_factory.mktemp("capnp") tmp_log_capnp_path = tmp_dir / f"{commit}-log.capnp" if not tmp_log_capnp_path.exists(): run_cmd(["curl", "-o", str(tmp_log_capnp_path), log_capnp_url]) @@ -32,7 +34,7 @@ def parent_schema_file(tmp_path_factory): def test_log_backwards_compatibility(parent_schema_file, data): # capnp global parser needs to be cleaned up to avoid schema/struct ID conflicts capnp_parser = capnp.SchemaParser() - old_log = capnp_parser.load(parent_schema_file, imports=[CEREAL_PATH]) + old_log = capnp_parser.load(os.path.abspath(parent_schema_file)) msgs_dicts = FuzzyGenerator.get_random_event_msg(data.draw, log_schema=old_log, events=old_log.Event.schema.union_fields, real_floats=True) msgs = [old_log.Event.new_message(**m).as_reader() for m in msgs_dicts]