From 590247a5f78ed66ffdccbcb7af2df3f52e92676d Mon Sep 17 00:00:00 2001 From: alceops Date: Wed, 29 Apr 2026 21:18:25 +0000 Subject: [PATCH] Fix data hyper-cleaning test script path --- .../test_data_hyper_cleaning.py | 47 +++++++++---------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/examples/data_hyper_cleaning/test_data_hyper_cleaning.py b/examples/data_hyper_cleaning/test_data_hyper_cleaning.py index 4dd7908..83b6d26 100644 --- a/examples/data_hyper_cleaning/test_data_hyper_cleaning.py +++ b/examples/data_hyper_cleaning/test_data_hyper_cleaning.py @@ -1,6 +1,15 @@ -import pytest import subprocess -from unittest.mock import patch +import sys +from pathlib import Path + +import pytest + +DATA_HYPER_CLEANING_SCRIPT = Path(__file__).with_name("data_hyper_cleaning.py") + + +def run_data_hyper_cleaning(*args): + command = [sys.executable, str(DATA_HYPER_CLEANING_SCRIPT), *args] + return subprocess.run(command, capture_output=True, text=True) gm_oplist = ( ["NGD"], @@ -37,20 +46,17 @@ ], ) def test_combination_dynamic_na_op(gm_op, na_op): - command = [ - "python", - "/home/runner/work/BOAT/BOAT/examples/data_hyper_cleaning/data_hyper_cleaning.py", + print( + f"Running test with gm_op={gm_op} and na_op={na_op}" + ) + + result = run_data_hyper_cleaning( "--gm_op", ",".join(gm_op), "--na_op", ",".join(na_op), - ] - print( - f"Running test with gm_op={gm_op} and na_op={na_op}" ) - result = subprocess.run(command, capture_output=True, text=True) - assert ( result.returncode == 0 ), f"Test failed for gm_op={gm_op} and na_op={na_op}. Error: {result.stderr}" @@ -65,20 +71,17 @@ def test_combination_dynamic_na_op(gm_op, na_op): ], ) def test_combination_dynamic_na_op_dm(gm_op, na_op): - command = [ - "python", - "/home/runner/work/BOAT/BOAT/examples/data_hyper_cleaning/data_hyper_cleaning.py", + print( + f"Running test with gm_op={gm_op} and na_op={na_op}" + ) + + result = run_data_hyper_cleaning( "--gm_op", ",".join(gm_op), "--na_op", ",".join(na_op), - ] - print( - f"Running test with gm_op={gm_op} and na_op={na_op}" ) - result = subprocess.run(command, capture_output=True, text=True) - assert ( result.returncode == 0 ), f"Test failed for gm_op={gm_op} and na_op={na_op}. Error: {result.stderr}" @@ -86,15 +89,9 @@ def test_combination_dynamic_na_op_dm(gm_op, na_op): @pytest.mark.parametrize("fo_ol_method", fo_ol_method) def test_fo_ol_method(fo_ol_method): - command = [ - "python", - "/home/runner/work/BOAT/BOAT/examples/data_hyper_cleaning/data_hyper_cleaning.py", - "--fo_op", - fo_ol_method[0], - ] print(f"Running test with fo_op={fo_ol_method}") - result = subprocess.run(command, capture_output=True, text=True) + result = run_data_hyper_cleaning("--fo_op", fo_ol_method[0]) assert ( result.returncode == 0