File size: 1,965 Bytes
60b6623
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python3
"""Run all integration tests for the PromptAid Vision backend"""

import unittest
import sys
import os
import time

def run_integration_tests():
    """Discover and run all integration tests"""
    print("🧪 Running PromptAid Vision Integration Tests")
    print("=" * 50)

    # Add the app directory to the path
    app_path = os.path.join(os.path.dirname(__file__), '..', '..', 'app')
    sys.path.insert(0, app_path)

    # Discover tests in the current directory
    loader = unittest.TestLoader()
    start_dir = os.path.dirname(__file__)
    suite = loader.discover(start_dir, pattern='test_*.py')

    # Run tests
    runner = unittest.TextTestRunner(verbosity=2)
    start_time = time.time()

    result = runner.run(suite)

    end_time = time.time()
    duration = end_time - start_time

    # Print summary
    print("\n" + "=" * 50)
    print("INTEGRATION TEST SUMMARY")
    print("=" * 50)
    print(f"Tests Run: {result.testsRun}")
    print(f"Failures: {len(result.failures)}")
    print(f"Errors: {len(result.errors)}")
    print(f"Skipped: {len(result.skipped)}")
    print(f"Duration: {duration:.2f} seconds")

    if result.failures:
        print("\n❌ FAILURES:")
        for test, traceback in result.failures:
            print(f"  - {test}: {traceback.split('AssertionError:')[-1].strip()}")

    if result.errors:
        print("\n❌ ERRORS:")
        for test, traceback in result.errors:
            print(f"  - {test}: {traceback.split('Exception:')[-1].strip()}")

    if result.skipped:
        print("\n⚠️  SKIPPED:")
        for test, reason in result.skipped:
            print(f"  - {test}: {reason}")

    if result.wasSuccessful():
        print("\n✅ SUCCESS: All integration tests passed!")
        return 0
    else:
        print(f"\n❌ FAILURE: {len(result.failures) + len(result.errors)} test(s) failed!")
        return 1

if __name__ == '__main__':
    sys.exit(run_integration_tests())