Skip to content

Commit 3d9456f

Browse files
committed
fix: skip tests correctly
1 parent 38ef8d8 commit 3d9456f

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

causal_testing/main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
from causal_testing.specification.variable import Input, Output
2121
from causal_testing.testing.base_test_case import BaseTestCase
2222
from causal_testing.testing.causal_effect import Negative, NoEffect, Positive, SomeEffect
23+
from causal_testing.testing.causal_test_adequacy import DataAdequacy
2324
from causal_testing.testing.causal_test_case import CausalTestCase
2425
from causal_testing.testing.causal_test_result import CausalTestResult
25-
from causal_testing.testing.causal_test_adequacy import DataAdequacy
2626

2727
logger = logging.getLogger(__name__)
2828

@@ -446,9 +446,11 @@ def save_results(self, results: List[CausalTestResult], output_path: str = None)
446446
with open(self.paths.test_config_path, "r", encoding="utf-8") as f:
447447
test_configs = json.load(f)
448448

449+
active_tests = [test for test in test_configs["tests"] if not test.get("skip", False)]
450+
449451
# Combine test configs with their results
450452
json_results = []
451-
for test_config, test_case, result in zip(test_configs["tests"], self.test_cases, results):
453+
for test_config, test_case, result in zip(active_tests, self.test_cases, results):
452454
# Determine if test failed based on expected vs actual effect
453455
test_passed = (
454456
test_case.expected_causal_effect.apply(result) if result.effect_estimate is not None else False

tests/main_tests/test_main.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,11 @@ def test_ctf(self):
155155
with open(self.test_config_path, "r", encoding="utf-8") as f:
156156
test_configs = json.load(f)
157157

158+
active_tests = [test for test in test_configs["tests"] if not test.get("skip", False)]
159+
158160
tests_passed = [
159161
test_case.expected_causal_effect.apply(result) if result.effect_estimate is not None else False
160-
for test_config, test_case, result in zip(test_configs["tests"], framework.test_cases, results)
162+
for test_config, test_case, result in zip(active_tests, framework.test_cases, results)
161163
]
162164

163165
self.assertEqual(tests_passed, [True])
@@ -230,9 +232,10 @@ def test_ctf_exception_silent(self):
230232
with open(self.test_config_path, "r", encoding="utf-8") as f:
231233
test_configs = json.load(f)
232234

235+
active_tests = [test for test in test_configs["tests"] if not test.get("skip", False)]
233236
tests_passed = [
234237
test_case.expected_causal_effect.apply(result) if result.effect_estimate is not None else False
235-
for test_config, test_case, result in zip(test_configs["tests"], framework.test_cases, results)
238+
for test_config, test_case, result in zip(active_tests, framework.test_cases, results)
236239
]
237240

238241
self.assertEqual(tests_passed, [False])

0 commit comments

Comments
 (0)