Skip to content

Commit

Permalink
Delete read only overlays before erasing buffer for an Org test
Browse files Browse the repository at this point in the history
Some tests can cause the execution of asynchronous code blocks and
those overlays may not be removed before the start of the next Org
based test.

* jupyter-org-client.el (jupyter-org--make-overlay): Add `jupyter'
property to overlay.

* test/test-helper.el (jupyter-org-test-setup): Delete those overlays
before erasing the buffer.
  • Loading branch information
nnicandro committed Oct 9, 2024
1 parent 4b1dba3 commit a2a4a04
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions jupyter-org-client.el
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ e.g. `org-babel-get-src-block-info'."
(defun jupyter-org--make-overlay (beg end &optional inline)
"Create overlay between BEG and END positions and return it."
(let ((overlay (make-overlay beg end)))
(overlay-put overlay 'jupyter t)
(overlay-put overlay 'face 'secondary-selection)
(let ((read-only
(list
Expand Down
6 changes: 6 additions & 0 deletions test/test-helper.el
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,12 @@ should have PROP with VAL."
(with-current-buffer jupyter-org-test-buffer
(org-mode)))
(with-current-buffer jupyter-org-test-buffer
;; NOTE: Remove overlays introduced by
;; `jupyter-org--make-overlay', these should have no bearing on if
;; a test passes or not.
(dolist (ov (overlays-in (point-min) (point-max)))
(when (overlay-get ov 'jupyter)
(delete-overlay ov)))
(erase-buffer)))

(defun jupyter-org-test-client-from-info (info)
Expand Down

0 comments on commit a2a4a04

Please sign in to comment.