File size: 1,466 Bytes
82f9be0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
44
45
46
47
48
49
50
51
52
53
"""
ζ‰Ήι‡θΏθ‘Œζ‰€ζœ‰ζ΅‹θ―•
"""

import unittest
import sys
import os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


def run_unit_tests():
    """θΏθ‘Œε•ε…ƒζ΅‹θ―•"""
    print("=== θΏθ‘Œε•ε…ƒζ΅‹θ―• ===")
    loader = unittest.TestLoader()
    suite = loader.discover('tests/unit', pattern='test_*.py')
    runner = unittest.TextTestRunner(verbosity=2)
    result = runner.run(suite)
    return result.wasSuccessful()


def run_integration_tests():
    """θΏθ‘Œι›†ζˆζ΅‹θ―•"""
    print("\n=== θΏθ‘Œι›†ζˆζ΅‹θ―• ===")
    loader = unittest.TestLoader()
    suite = loader.discover('tests/integration', pattern='test_*.py')
    runner = unittest.TextTestRunner(verbosity=2)
    result = runner.run(suite)
    return result.wasSuccessful()


def run_all_tests():
    """θΏθ‘Œζ‰€ζœ‰ζ΅‹θ―•"""
    print("Human-Clone η³»η»Ÿζ΅‹θ―•ε₯—δ»Ά")
    print("=" * 50)
    
    unit_success = run_unit_tests()
    integration_success = run_integration_tests()
    
    print("\n=== ζ΅‹θ―•η»“ζžœζ±‡ζ€» ===")
    print(f"单元桋试: {'βœ“ ι€šθΏ‡' if unit_success else 'βœ— ε€±θ΄₯'}")
    print(f"ι›†ζˆζ΅‹θ―•: {'βœ“ ι€šθΏ‡' if integration_success else 'βœ— ε€±θ΄₯'}")
    
    if unit_success and integration_success:
        print("πŸŽ‰ ζ‰€ζœ‰ζ΅‹θ―•ι€šθΏ‡!")
        return True
    else:
        print("❌ ε­˜εœ¨ζ΅‹θ―•ε€±θ΄₯")
        return False


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