Stabilize test imports with explicit project root path
This commit is contained in:
@@ -1,12 +1,18 @@
|
|||||||
import importlib
|
import importlib
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
from pathlib import Path
|
||||||
from typing import Iterator
|
from typing import Iterator
|
||||||
|
|
||||||
import pymysql
|
import pymysql
|
||||||
import pytest
|
import pytest
|
||||||
from fastapi.testclient import TestClient
|
from fastapi.testclient import TestClient
|
||||||
|
|
||||||
|
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
||||||
|
if str(PROJECT_ROOT) not in sys.path:
|
||||||
|
sys.path.insert(0, str(PROJECT_ROOT))
|
||||||
|
|
||||||
|
|
||||||
def wait_for_db(host: str, port: int, user: str, password: str, timeout_seconds: int = 60) -> None:
|
def wait_for_db(host: str, port: int, user: str, password: str, timeout_seconds: int = 60) -> None:
|
||||||
deadline = time.time() + timeout_seconds
|
deadline = time.time() + timeout_seconds
|
||||||
|
|||||||
Reference in New Issue
Block a user