Skip to content

Commit 00f996d

Browse files
committed
fix tests for robust workflow to run more efficiently
1 parent f89cdd8 commit 00f996d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

tests/test_robust_workflow.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import pandas as pd
99
import pandas.testing as pdt
1010
import papermill as pm
11+
import pytest
1112

1213
os.chdir("examples/notebooks")
1314

@@ -57,14 +58,20 @@ def load_csv_pair(filename: str) -> Tuple[pd.DataFrame, pd.DataFrame]:
5758

5859
def compare_results(filename: str, atol: float = 1e-8):
5960
"""Execute notebook and compare results against expected baseline."""
60-
execute_notebook()
6161
current, expected = load_csv_pair(filename)
6262
pdt.assert_frame_equal(current, expected, atol=atol, check_dtype=False)
6363
print(
6464
f"Regression test passed for {filename}: current results match expected baseline."
6565
)
6666

6767

68+
# Execute notebook once before all tests
69+
@pytest.fixture(scope="module", autouse=True)
70+
def setup_module():
71+
"""Execute notebook once before running all tests."""
72+
execute_notebook()
73+
74+
6875
def test_linear_transient_to_plateau():
6976
compare_results("linear_transient_to_plateau.csv", atol=1e-8)
7077

0 commit comments

Comments
 (0)