[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#52380: ERT, buffers and windows
From: |
Kévin Le Gouguec |
Subject: |
bug#52380: ERT, buffers and windows |
Date: |
Fri, 10 Dec 2021 21:58:16 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Kévin Le Gouguec <kevin.legouguec@gmail.com>
>> Date: Fri, 10 Dec 2021 21:09:30 +0100
>> Cc: 52380@debbugs.gnu.org
>>
>> If I amend the test as follows:
>>
>> diff --git a/test/lisp/progmodes/python-tests.el
>> b/test/lisp/progmodes/python-tests.el
>> index 15bda5c197..783f115fc7 100644
>> --- a/test/lisp/progmodes/python-tests.el
>> +++ b/test/lisp/progmodes/python-tests.el
>> @@ -5454,6 +5454,7 @@ python-tests--bug31398
>> "Test for https://debbugs.gnu.org/31398 ."
>> (skip-unless (executable-find python-tests-shell-interpreter))
>> (let ((buffer (process-buffer (run-python nil nil 'show))))
>> + (should (eq (get-buffer-window buffer) (selected-window)))
>> (should (eq buffer (current-buffer)))
>> (pop-to-buffer (other-buffer))
>> (run-python nil nil 'show)
>>
>> … then (should (eq (get-buffer-window buffer) (selected-window)))
>> passes, but (should (eq buffer (current-buffer))) does not. Does that
>> make sense to anyone?
>
> You assume that the selected window always shows the current buffer?
> That's not in general true.
Mmm, thanks. I see that "(elisp) Current Buffer" has things to say on
the subject:
> When an editing command returns to the editor command loop, Emacs
> automatically calls ‘set-buffer’ on the buffer shown in the selected
> window (*note Selecting Windows::).
In the context of ERT, what would be the correct way to test that after
calling M-x run-python (≡ (run-python nil nil 'show)), the *Python*
buffer is visible, and its window is selected?
Should we just disregard (current-buffer) when writing ERT tests, and
assert things in terms of (selected-window)? Or is there a way to make
ERT "return to the editor command loop", thereby selecting the buffer
shown in the selected window?
- bug#52380: 28.0.50; [PATCH] run-python no longer focuses interpreter, Kévin Le Gouguec, 2021/12/08
- bug#52380: 28.0.50; [PATCH] run-python no longer focuses interpreter, Lars Ingebrigtsen, 2021/12/10
- bug#52380: 28.0.50; [PATCH] run-python no longer focuses interpreter, Lars Ingebrigtsen, 2021/12/10
- bug#52380: 28.0.50; [PATCH] run-python no longer focuses interpreter, Kévin Le Gouguec, 2021/12/10
- bug#52380: ERT, buffers and windows (was: bug#52380: 28.0.50; [PATCH] run-python no longer focuses interpreter), Kévin Le Gouguec, 2021/12/10
- bug#52380: ERT, buffers and windows (was: bug#52380: 28.0.50; [PATCH] run-python no longer focuses interpreter), Eli Zaretskii, 2021/12/10
- bug#52380: ERT, buffers and windows,
Kévin Le Gouguec <=
- bug#52380: 28.0.50; [PATCH] run-python no longer focuses interpreter, Kévin Le Gouguec, 2021/12/11
- bug#52380: 28.0.50; [PATCH] run-python no longer focuses interpreter, Lars Ingebrigtsen, 2021/12/12
- bug#52380: 28.0.50; [PATCH v2] run-python no longer focuses interpreter, Kévin Le Gouguec, 2021/12/12
- bug#52380: 28.0.50; [PATCH v2] run-python no longer focuses interpreter, Lars Ingebrigtsen, 2021/12/12