-
Notifications
You must be signed in to change notification settings - Fork 122
Conversation
We need to use a context manager on `TestClient` (call it in a `with()` cluase) to properly start the app inside
Used fixtures to correctly set the a random index name, and a fixture for tearing it down even if there was a failure
The retry needs to retry the /query operation itself.
Tested, this solution works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, can merge
def test_upsert(client): | ||
# Upsert a document to the index | ||
upsert_response = client.post("/context/upsert", json=upsert_payload.dict()) | ||
assert upsert_response.is_success |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you're separating the test so each one should have at least 1 logical test and not just operational (is_success)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How? There's no return value for upsert...
chat_response_content = chat_response_as_json["choices"][0]["message"][ | ||
"content" | ||
] | ||
print(chat_response_content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this for debugging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're asking me...?
That's your code!
This way it will run from any working directory
Problem
Multiple problems:
startup
event)test_
function instead of separate test case per app routeSolution
Use proper
fixture
s and context manager.Type of Change