Check if server is running (requires manual server start).
()
| 53 | |
| 54 | @pytest.fixture(scope="module") |
| 55 | def server_process(): |
| 56 | """Check if server is running (requires manual server start).""" |
| 57 | # Check if server is already running on port 8000 |
| 58 | try: |
| 59 | response = requests.get("http://localhost:8000/health", timeout=2) |
| 60 | if response.status_code == 200: |
| 61 | print("\n[OK] Server is running on port 8000") |
| 62 | yield None # No process to manage |
| 63 | return |
| 64 | except (requests.ConnectionError, requests.Timeout): |
| 65 | pass |
| 66 | |
| 67 | # If not, fail with helpful message |
| 68 | pytest.fail( |
| 69 | "\n" + "=" * 70 + "\n" |
| 70 | "Server is not running on port 8000!\n\n" |
| 71 | "Integration tests require a manually started server:\n" |
| 72 | " Terminal 1: python scripts/start_server.py --port 8000\n" |
| 73 | " Terminal 2: pytest tests/test_memory_integration.py -v -m integration\n\n" |
| 74 | "See tests/README.md for details.\n" + "=" * 70 |
| 75 | ) |
| 76 | |
| 77 | |
| 78 | @pytest_asyncio.fixture(scope="module", loop_scope="module") |