feat: Add sqlite to blocking call detection (#4376)
This commit is contained in:
parent
c0b25fa651
commit
abf38e96e2
3 changed files with 4 additions and 7 deletions
|
|
@ -63,9 +63,6 @@ def blockbuster(request):
|
||||||
"io.TextIOWrapper.read",
|
"io.TextIOWrapper.read",
|
||||||
]:
|
]:
|
||||||
bb.functions[func].can_block_functions.append(("importlib_metadata/__init__.py", {"metadata"}))
|
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()
|
bb.functions["threading.Lock.acquire"].deactivate()
|
||||||
yield bb
|
yield bb
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,10 @@ async def test_login_unsuccessful_wrong_username(client):
|
||||||
assert response.json()["detail"] == "Incorrect username or password"
|
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
|
# Adding the test user to the database
|
||||||
session.add(test_user)
|
async_session.add(test_user)
|
||||||
session.commit()
|
await async_session.commit()
|
||||||
|
|
||||||
response = await client.post("api/v1/login", data={"username": "testuser", "password": "wrongpassword"})
|
response = await client.post("api/v1/login", data={"username": "testuser", "password": "wrongpassword"})
|
||||||
assert response.status_code == 401
|
assert response.status_code == 401
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ async def created_message():
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
async def created_messages(session): # noqa: ARG001
|
async def created_messages(async_session): # noqa: ARG001
|
||||||
async with async_session_scope() as _session:
|
async with async_session_scope() as _session:
|
||||||
messages = [
|
messages = [
|
||||||
MessageCreate(text="Test message 1", sender="User", sender_name="User", session_id="session_id2"),
|
MessageCreate(text="Test message 1", sender="User", sender_name="User", session_id="session_id2"),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue