mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-25 14:02:51 +00:00
test-ob-octave.el: Avoid race condition on slow machines
* testing/lisp/test-ob-octave.el (ob-octave/graphics-file): (ob-octave/graphics-file-session): (ob-octave/graphics-file-space): Delay `should' condition waiting for file contents to be written by octave. This may be necessary when octave has not yet written the file contents (on slow machines). Re-enable tests. Link: https://orgmode.org/list/87r0wk29dz.fsf@localhost
This commit is contained in:
parent
fc4bbb28f8
commit
e5c45358ae
|
@ -67,7 +67,6 @@
|
|||
(ert-deftest ob-octave/graphics-file ()
|
||||
"Graphics file. Test that link is correctly inserted and graphics file is created (and not empty). Clean-up side-effects."
|
||||
;; In case a prior test left the Error Output buffer hanging around.
|
||||
(skip-unless nil) ; FIXME: Failing on CI only
|
||||
(when (get-buffer "*Org-Babel Error Output*")
|
||||
(kill-buffer "*Org-Babel Error Output*"))
|
||||
(let ((file (make-temp-file "test-ob-octave-" nil ".png")))
|
||||
|
@ -80,7 +79,12 @@ sombrero;
|
|||
(org-babel-execute-src-block)
|
||||
(should (search-forward (format "[[file:%s]]" file) nil nil))
|
||||
(should (file-readable-p file))
|
||||
(should (> (file-attribute-size (file-attributes file)) 0))
|
||||
(should (or (> (file-attribute-size (file-attributes file)) 0)
|
||||
;; Avoid race condition on slow machines.
|
||||
;; https://orgmode.org/list/87r0wk29dz.fsf@localhost
|
||||
(progn
|
||||
(sleep-for 1)
|
||||
(> (file-attribute-size (file-attributes file)) 0))))
|
||||
(should-not (get-buffer "*Org-Babel Error Output*")))
|
||||
;; clean-up
|
||||
(delete-file file)
|
||||
|
@ -89,7 +93,6 @@ sombrero;
|
|||
|
||||
(ert-deftest ob-octave/graphics-file-session ()
|
||||
"Graphics file in a session. Test that session is started in *Inferior Octave* buffer, link is correctly inserted and graphics file is created (and not empty). Clean-up side-effects."
|
||||
(skip-unless nil) ; FIXME: Failing on CI only
|
||||
(let ((file (make-temp-file "test-ob-octave-" nil ".png")))
|
||||
(unwind-protect
|
||||
(org-test-with-temp-text
|
||||
|
@ -102,7 +105,12 @@ sombrero;
|
|||
(should (get-buffer "*Inferior Octave*"))
|
||||
(should (search-forward (format "[[file:%s]]" file) nil nil))
|
||||
(should (file-readable-p file))
|
||||
(should (> (file-attribute-size (file-attributes file)) 0))
|
||||
(or (> (file-attribute-size (file-attributes file)) 0)
|
||||
;; Avoid race condition on slow machines.
|
||||
;; https://orgmode.org/list/87r0wk29dz.fsf@localhost
|
||||
(progn
|
||||
(sleep-for 1)
|
||||
(> (file-attribute-size (file-attributes file)) 0)))
|
||||
(should-not (get-buffer "*Org-Babel Error Output*")))
|
||||
;; clean-up
|
||||
(delete-file file)
|
||||
|
@ -113,7 +121,6 @@ sombrero;
|
|||
|
||||
(ert-deftest ob-octave/graphics-file-space ()
|
||||
"Graphics file with a space in filename. Test that session is started in *Inferior Octave* buffer, link is correctly inserted and graphics file is created (and not empty). Clean-up side-effects."
|
||||
(skip-unless nil) ; FIXME: Failing on CI only
|
||||
(let ((file (make-temp-file "test ob octave-" nil ".png")))
|
||||
(unwind-protect
|
||||
(org-test-with-temp-text
|
||||
|
@ -124,7 +131,12 @@ sombrero;
|
|||
(org-babel-execute-src-block)
|
||||
(should (search-forward (format "[[file:%s]]" file) nil nil))
|
||||
(should (file-readable-p file))
|
||||
(should (> (file-attribute-size (file-attributes file)) 0))
|
||||
(or (> (file-attribute-size (file-attributes file)) 0)
|
||||
;; Avoid race condition on slow machines.
|
||||
;; https://orgmode.org/list/87r0wk29dz.fsf@localhost
|
||||
(progn
|
||||
(sleep-for 1)
|
||||
(> (file-attribute-size (file-attributes file)) 0)))
|
||||
(should-not (get-buffer "*Org-Babel Error Output*")))
|
||||
;; clean-up
|
||||
(delete-file file)
|
||||
|
|
Loading…
Reference in a new issue