Subject: bug#52380: ERT, buffers and windows (was: bug#52380: 28.0.50; [PATCH] run-python no longer focuses interpreter)

From: Eli Zaretskii <[email-masked]>
Date: Fri, 10 Dec 2021 22:30:50 +0200

> From: Kévin Le Gouguec <[email-masked]>
> Date: Fri, 10 Dec 2021 21:09:30 +0100
> Cc: [email-masked]
> 
> 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.