diff --git a/test/conftest.py b/test/conftest.py
index 6dd2bf4a6dc5537f16ffd4edfa15ecbfd75434c3..d7b98bf8bad410cf7259381ad210e2e8916f564e 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -1,4 +1,5 @@
 import io
+import json
 import os
 import re
 import sys
@@ -533,7 +534,9 @@ def compile() -> None:
 
 @pytest.fixture(scope="session")
 def binary_path(compile, pytestconfig) -> str:
-    return os.path.realpath(pytestconfig.rootpath / "target/debug/picodata")
+    metadata = subprocess.check_output(["cargo", "metadata", "--format-version=1"])
+    target = json.loads(metadata)["target_directory"]
+    return os.path.realpath(os.path.join(target, "debug/picodata"))
 
 
 @pytest.fixture(scope="session")