branch: externals/llm
commit d1acfe2bb8afa6f9222c6808530b12a68aaa14cf
Author: Andrew Hyatt <[email protected]>
Commit: GitHub <[email protected]>

    Fix integration test false positives (#129)
---
 llm-integration-test.el | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/llm-integration-test.el b/llm-integration-test.el
index edfc6be768..bab1e63649 100644
--- a/llm-integration-test.el
+++ b/llm-integration-test.el
@@ -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)))
@@ -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)))
@@ -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)))
@@ -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)))

Reply via email to