Skip to content

Commit

Permalink
Fix integration test false positives (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyatt authored Dec 22, 2024
1 parent e8dfb89 commit d1acfe2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions llm-integration-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ else. We really just want to see if it's in the right ballpark."
provider
"Paris"
(lambda (response)
(should (eq (current-buffer) buf))
(should (or (not (buffer-live-p buf)) (eq (current-buffer) buf)))
(setq result response))
(lambda (error)
(error "Error: %s" error)))
Expand All @@ -196,7 +196,7 @@ else. We really just want to see if it's in the right ballpark."
provider
'("Paris" "France")
(lambda (response)
(should (eq (current-buffer) buf))
(should (or (not (buffer-live-p buf)) (eq (current-buffer) buf)))
(setq result response))
(lambda (error)
(error "Error: %s" error)))
Expand All @@ -223,7 +223,7 @@ else. We really just want to see if it's in the right ballpark."
provider
(llm-make-chat-prompt llm-integration-test-chat-prompt)
(lambda (response)
(should (eq (current-buffer) buf))
(should (or (not (buffer-live-p buf)) (eq (current-buffer) buf)))
(setq result response))
(lambda (_ err)
(setq err-result err)))
Expand All @@ -244,16 +244,17 @@ else. We really just want to see if it's in the right ballpark."
provider
(llm-make-chat-prompt llm-integration-test-chat-prompt)
(lambda (partial-response)
(should (eq (current-buffer) buf))
(should (or (not (buffer-live-p buf)) (eq (current-buffer) buf)))
(setq streamed-result (concat streamed-result partial-response)))
(lambda (response)
(should (eq (current-buffer) buf))
(should (or (not (buffer-live-p buf)) (eq (current-buffer) buf)))
(setq returned-result response))
(lambda (_ err)
(setq err-result err)))
(while (and (null returned-result)
(while (and (or (null returned-result)
(= (length streamed-result) 0))
(null err-result)
(time-less-p (time-subtract (current-time) start-time) 10))
(time-less-p (time-subtract (current-time) start-time) 60))
(sleep-for 0.1))
(if err-result (error err-result))
(should (llm-integration-test-string-eq llm-integration-test-chat-answer (string-trim returned-result)))
Expand Down

0 comments on commit d1acfe2

Please sign in to comment.