-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LifespanManager AsyncClient TimeOut Error - Apple Mac M1 #8
Comments
Thank you very much! |
Thank you very much, M1 is really good but also very painful, I also spent whole day to figure out the reason. |
I'm also having concurrency issues in dockerized exection on M1. Another problem is |
thanks! In my case i had to also update
|
I enjoyed this Fastapi series and had everything working until I updated my computer from Mac Pro 2015 to Mac Air (M1). From there I experienced unexplained concurrency and time out errors when running pytest. Tests would sometimes work other times fail. After several days of trial and error I narrowed the issue to httpx AsyncClient or LIfespan manager. Sharing the solution in case anyone else has the same issue.
fastapi==0.65.0
uvicorn==0.15.0
pydantic==1.4
email-validator== 1.1.1
databases[postgresql]==0.5.3
SQLAlchemy==1.4.27
alembic== 1.7.5
psycopg2-binary==2.9.2
pytest== 6.2.5
pytest-asyncio== 0.16.0
async_asgi_testclient==1.4.7
from async_asgi_testclient import TestClient
@pytest.fixture
async def client(app: FastAPI) -> TestClient:
async with TestClient(app) as client:
yield client
from async_asgi_testclient import TestClient
class TestCreateCleaning:
async def test_valid_input_creates_cleaning(
self, app: FastAPI, client: TestClient, new_cleaning: CleaningCreate
) -> None:
res = await client.post(
app.url_path_for("cleanings:create-cleaning"),
headers={"Content-Type": "application/json"},
json={"new_cleaning": new_cleaning.dict()}
)
assert res.status_code == HTTP_201_CREATED
The text was updated successfully, but these errors were encountered: