From 5a2787a03937e1c26e957fd568a8af4e79be2649 Mon Sep 17 00:00:00 2001 From: Joe Knapper Date: Thu, 26 Mar 2026 17:25:33 +0000 Subject: [PATCH] Data path based on containing DIR location --- tests/unit_tests/test_stack_examples.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/unit_tests/test_stack_examples.py b/tests/unit_tests/test_stack_examples.py index 217eedf7..81fda2d2 100644 --- a/tests/unit_tests/test_stack_examples.py +++ b/tests/unit_tests/test_stack_examples.py @@ -9,11 +9,14 @@ objects to simulate real camera captures. """ import json +import os from labthings_fastapi.testing import create_thing_without_server from openflexure_microscope_server.things.autofocus import AutofocusThing +THIS_DIR = os.path.dirname(__file__) +DATA_PATH = os.path.join(THIS_DIR, "data", "sharpness_test_cases.json") class MockCapture: """Simple mock object representing a captured image. @@ -53,7 +56,8 @@ def test_stack_labelling(): Expected labels may be a single value or a list of acceptable values. """ autofocus_thing = create_thing_without_server(AutofocusThing, mock_all_slots=True) - with open(r"tests\unit_tests\data\sharpness_test_cases.json") as f: + + with open(DATA_PATH) as f: data = json.load(f) success = 0