Skip to content

Commit 11d39aa

Browse files
committed
Extra test for codecov
1 parent 402dafb commit 11d39aa

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

tests/main_tests/test_main.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import unittest
2+
from pathlib import Path
3+
import tempfile
4+
import os
5+
26
import shutil
37
import json
48
import pandas as pd
5-
from pathlib import Path
6-
from causal_testing.main import CausalTestingPaths, CausalTestingFramework, parse_args
7-
from causal_testing.__main__ import main
89
from unittest.mock import patch
910

11+
from causal_testing.main import CausalTestingPaths, CausalTestingFramework
12+
from causal_testing.__main__ import main
13+
1014

1115
class TestCausalTestingPaths(unittest.TestCase):
1216

@@ -144,6 +148,29 @@ def test_ctf(self):
144148

145149
self.assertEqual(tests_passed, [True])
146150

151+
def test_ctf_batches(self):
152+
framework = CausalTestingFramework(self.paths)
153+
framework.setup()
154+
155+
# Load and run tests
156+
framework.load_tests()
157+
158+
output_files = []
159+
with tempfile.TemporaryDirectory() as tmpdir:
160+
for i, results in enumerate(framework.run_tests_in_batches()):
161+
temp_file_path = os.path.join(tmpdir, f"output_{i}.json")
162+
framework.save_results(results, temp_file_path)
163+
output_files.append(temp_file_path)
164+
del results
165+
166+
# Now stitch the results together from the temporary files
167+
all_results = []
168+
for file_path in output_files:
169+
with open(file_path, "r", encoding="utf-8") as f:
170+
all_results.extend(json.load(f))
171+
172+
self.assertEqual([result["passed"] for result in all_results], [True])
173+
147174
def test_global_query(self):
148175
framework = CausalTestingFramework(self.paths)
149176
framework.setup()

0 commit comments

Comments
 (0)