aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/progmodes/python-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/progmodes/python-tests.el')
-rw-r--r--test/lisp/progmodes/python-tests.el23
1 files changed, 12 insertions, 11 deletions
diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el
index 6ab9c62746e..15bda5c197a 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -22,6 +22,7 @@
22;;; Code: 22;;; Code:
23 23
24(require 'ert) 24(require 'ert)
25(require 'ert-x)
25(require 'python) 26(require 'python)
26 27
27;; Dependencies for testing: 28;; Dependencies for testing:
@@ -48,17 +49,17 @@ BODY is code to be executed within the temp buffer. Point is
48always located at the beginning of buffer." 49always located at the beginning of buffer."
49 (declare (indent 1) (debug t)) 50 (declare (indent 1) (debug t))
50 ;; temp-file never actually used for anything? 51 ;; temp-file never actually used for anything?
51 `(let* ((temp-file (make-temp-file "python-tests" nil ".py")) 52 `(ert-with-temp-file temp-file
52 (buffer (find-file-noselect temp-file)) 53 :suffix "-python.py"
53 (python-indent-guess-indent-offset nil)) 54 (let ((buffer (find-file-noselect temp-file))
54 (unwind-protect 55 (python-indent-guess-indent-offset nil))
55 (with-current-buffer buffer 56 (unwind-protect
56 (python-mode) 57 (with-current-buffer buffer
57 (insert ,contents) 58 (python-mode)
58 (goto-char (point-min)) 59 (insert ,contents)
59 ,@body) 60 (goto-char (point-min))
60 (and buffer (kill-buffer buffer)) 61 ,@body)
61 (delete-file temp-file)))) 62 (and buffer (kill-buffer buffer))))))
62 63
63(defun python-tests-look-at (string &optional num restore-point) 64(defun python-tests-look-at (string &optional num restore-point)
64 "Move point at beginning of STRING in the current buffer. 65 "Move point at beginning of STRING in the current buffer.