Skip to content

Commit a2a4a04

Browse files
committed
Delete read only overlays before erasing buffer for an Org test
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.
1 parent 4b1dba3 commit a2a4a04

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

jupyter-org-client.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ e.g. `org-babel-get-src-block-info'."
176176
(defun jupyter-org--make-overlay (beg end &optional inline)
177177
"Create overlay between BEG and END positions and return it."
178178
(let ((overlay (make-overlay beg end)))
179+
(overlay-put overlay 'jupyter t)
179180
(overlay-put overlay 'face 'secondary-selection)
180181
(let ((read-only
181182
(list

test/test-helper.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,12 @@ should have PROP with VAL."
501501
(with-current-buffer jupyter-org-test-buffer
502502
(org-mode)))
503503
(with-current-buffer jupyter-org-test-buffer
504+
;; NOTE: Remove overlays introduced by
505+
;; `jupyter-org--make-overlay', these should have no bearing on if
506+
;; a test passes or not.
507+
(dolist (ov (overlays-in (point-min) (point-max)))
508+
(when (overlay-get ov 'jupyter)
509+
(delete-overlay ov)))
504510
(erase-buffer)))
505511

506512
(defun jupyter-org-test-client-from-info (info)

0 commit comments

Comments
 (0)