import pytest import sys import os # Insert backend directory in sys.path at the very top backend_dir = os.path.dirname(os.path.abspath(__file__)) if backend_dir not in sys.path: sys.path.insert(0, backend_dir) def run(): print("=" * 60) print("Starting Medical AI Chatbot Backend Test Suite...") print("=" * 60) # Force change CWD to backend directory os.chdir(backend_dir) # Run pytest with verbose mode and target tests/ directory exit_code = pytest.main(["-v", "tests/"]) print("\n" + "=" * 60) print("Test Execution Summary:") print("=" * 60) if exit_code == 0: print("SUCCESS: All tests passed successfully!") sys.exit(0) else: print(f"FAILURE: Test suite failed with exit code: {exit_code}") sys.exit(exit_code) if __name__ == "__main__": run()