Skip to content

Commit 7befe11

Browse files
committed
fix error Cannot use MongoClient after close
1 parent bf80408 commit 7befe11

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test_books_crud.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ async def startup_event():
1616

1717
@app.on_event("shutdown")
1818
async def shutdown_event():
19-
app.mongodb_client.close()
2019
app.database.drop_collection("books")
20+
app.mongodb_client.close()
2121

2222
def test_create_book():
2323
with TestClient(app) as client:

0 commit comments

Comments
 (0)