feat: Add sqlite to blocking call detection (#4376)

This commit is contained in:
Christophe Bornet 2024-12-09 11:48:48 +01:00 committed by GitHub
commit abf38e96e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 7 deletions

View file

@ -63,9 +63,6 @@ def blockbuster(request):
"io.TextIOWrapper.read",
]:
bb.functions[func].can_block_functions.append(("importlib_metadata/__init__.py", {"metadata"}))
for func in bb.functions:
if func.startswith("sqlite3."):
bb.functions[func].deactivate()
bb.functions["threading.Lock.acquire"].deactivate()
yield bb

View file

@ -35,10 +35,10 @@ async def test_login_unsuccessful_wrong_username(client):
assert response.json()["detail"] == "Incorrect username or password"
async def test_login_unsuccessful_wrong_password(client, test_user, session):
async def test_login_unsuccessful_wrong_password(client, test_user, async_session):
# Adding the test user to the database
session.add(test_user)
session.commit()
async_session.add(test_user)
await async_session.commit()
response = await client.post("api/v1/login", data={"username": "testuser", "password": "wrongpassword"})
assert response.status_code == 401

View file

@ -38,7 +38,7 @@ async def created_message():
@pytest.fixture
async def created_messages(session): # noqa: ARG001
async def created_messages(async_session): # noqa: ARG001
async with async_session_scope() as _session:
messages = [
MessageCreate(text="Test message 1", sender="User", sender_name="User", session_id="session_id2"),