Skip to content

Commit d1acfe2

Browse files
authored
Fix integration test false positives (#129)
1 parent e8dfb89 commit d1acfe2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

llm-integration-test.el

+8-7
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ else. We really just want to see if it's in the right ballpark."
170170
provider
171171
"Paris"
172172
(lambda (response)
173-
(should (eq (current-buffer) buf))
173+
(should (or (not (buffer-live-p buf)) (eq (current-buffer) buf)))
174174
(setq result response))
175175
(lambda (error)
176176
(error "Error: %s" error)))
@@ -196,7 +196,7 @@ else. We really just want to see if it's in the right ballpark."
196196
provider
197197
'("Paris" "France")
198198
(lambda (response)
199-
(should (eq (current-buffer) buf))
199+
(should (or (not (buffer-live-p buf)) (eq (current-buffer) buf)))
200200
(setq result response))
201201
(lambda (error)
202202
(error "Error: %s" error)))
@@ -223,7 +223,7 @@ else. We really just want to see if it's in the right ballpark."
223223
provider
224224
(llm-make-chat-prompt llm-integration-test-chat-prompt)
225225
(lambda (response)
226-
(should (eq (current-buffer) buf))
226+
(should (or (not (buffer-live-p buf)) (eq (current-buffer) buf)))
227227
(setq result response))
228228
(lambda (_ err)
229229
(setq err-result err)))
@@ -244,16 +244,17 @@ else. We really just want to see if it's in the right ballpark."
244244
provider
245245
(llm-make-chat-prompt llm-integration-test-chat-prompt)
246246
(lambda (partial-response)
247-
(should (eq (current-buffer) buf))
247+
(should (or (not (buffer-live-p buf)) (eq (current-buffer) buf)))
248248
(setq streamed-result (concat streamed-result partial-response)))
249249
(lambda (response)
250-
(should (eq (current-buffer) buf))
250+
(should (or (not (buffer-live-p buf)) (eq (current-buffer) buf)))
251251
(setq returned-result response))
252252
(lambda (_ err)
253253
(setq err-result err)))
254-
(while (and (null returned-result)
254+
(while (and (or (null returned-result)
255+
(= (length streamed-result) 0))
255256
(null err-result)
256-
(time-less-p (time-subtract (current-time) start-time) 10))
257+
(time-less-p (time-subtract (current-time) start-time) 60))
257258
(sleep-for 0.1))
258259
(if err-result (error err-result))
259260
(should (llm-integration-test-string-eq llm-integration-test-chat-answer (string-trim returned-result)))

0 commit comments

Comments
 (0)