Fix clearing test output buffer#15
Conversation
|
hmmm, strange. repeated invocations work perfectly fine for me, and i use this all the time. can you reproduce this in a clean environment? which emacs version? |
|
My emacs version is 26.1 (spaceemacs) |
|
Maybe proper fix should add (let ((comint-prompt-read-only nil))
...)before running test process. |
|
I experience exactly same issue with repeated test runs. Using spacemacs/develop and emacs28 |
|
ah, @m-novikov re your comment about totally forgot about this issue, would be happy to merge if someone tells me what the best variable is here... |
|
Instead of 'erase-buffer', how about using 'comint-clear-buffer', which works regardless of comint-prompt-read-only. diff --git a/python-pytest.el b/python-pytest.el
index 1f5ba4c..5b9d569 100644
--- a/python-pytest.el
+++ b/python-pytest.el
@@ -374,7 +374,6 @@ With a prefix ARG, allow editing."
(user-error "Aborting; pytest still running")))
(when process
(delete-process process))
- (erase-buffer)
(unless (eq major-mode 'python-pytest-mode)
(python-pytest-mode))
(compilation-forget-errors)
@@ -387,6 +386,7 @@ With a prefix ARG, allow editing."
nil t))
(run-hooks 'python-pytest-setup-hook)
(make-comint-in-buffer "pytest" buffer "sh" nil "-c" command)
+ (comint-clear-buffer)
(run-hooks 'python-pytest-started-hook)
(setq process (get-buffer-process buffer))
(set-process-sentinel process #'python-pytest--process-sentinel) |
|
wouldn't that clear the buffer after starting the process? that's a race condition that can cause output to get lost i think? 🤔 |
|
You are right. I did not consider that make-comint-in-buffer starts the process right away. By the way, the change in this PR, relying on inhibit-read-only seems to be fine as a proper way. For example, comint-clear-buffer is implemented based on inhibit-read-only in the same way and many other packages do the same. (comint-prompt-read-only simply does not work and the usage is not designed to be like inhibit-read-only) |
|
|
If we try to run a test without closing previous results buffer it will fail with error:
Text is read-onlyin mini-buffer.