-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.py
More file actions
43 lines (39 loc) · 1.27 KB
/
Copy pathrun_tests.py
File metadata and controls
43 lines (39 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import sys
import os
import shutil
# Ensure src is in path
sys.path.append(os.path.join(os.getcwd(), 'src'))
import tests.test_censor_entry as t1
import tests.test_registry_query as t2
import tests.test_bidirectional_learning as t3
import tests.test_generalization as t4
from negative_learning import CensorRegistry
def run_module_tests(module):
print(f"Running {module.__name__}...")
passed = 0
total = 0
for name, func in module.__dict__.items():
if name.startswith("test_") and callable(func):
total += 1
try:
# Simple fixture injection
if func.__code__.co_argcount > 0:
reg = CensorRegistry(data_path="test_temp.json")
func(reg)
else:
func()
print(f" [PASS] {name}")
passed += 1
except Exception as e:
print(f" [FAIL] {name}: {e}")
import traceback
traceback.print_exc()
print(f"Result: {passed}/{total} passed\n")
# Clean up
if os.path.exists("test_temp.json"):
os.remove("test_temp.json")
if __name__ == "__main__":
run_module_tests(t1)
run_module_tests(t2)
run_module_tests(t3)
run_module_tests(t4)