File size: 968 Bytes
411f252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""
Script to run all tests for the TutorX MCP server
"""
import sys
import os
import unittest
import pytest

def run_tests():
    """Run all tests"""
    print("Running TutorX-MCP Tests...")
    
    # First run unittest tests
    unittest_loader = unittest.TestLoader()
    test_directory = os.path.join(os.path.dirname(__file__), "tests")
    test_suite = unittest_loader.discover(test_directory)
    
    test_runner = unittest.TextTestRunner(verbosity=2)
    unittest_result = test_runner.run(test_suite)
    
    # Then run pytest tests (with coverage)
    pytest_args = [
        "tests", 
        "--cov=.",
        "--cov-report=term",
        "--cov-report=html:coverage_html",
        "-v"
    ]
    
    pytest_result = pytest.main(pytest_args)
    
    # Return success if both test runners succeeded
    return unittest_result.wasSuccessful() and pytest_result == 0

if __name__ == "__main__":
    success = run_tests()
    sys.exit(0 if success else 1)