From: Philip Kaludercic <philipk@posteo.net>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: Andrey Samsonov <samsonov.box@gmail.com>,
Eli Zaretskii <eliz@gnu.org>, Eshel Yaron <me@eshelyaron.com>,
Stefan Monnier <monnier@iro.umontreal.ca>,
65475-done@debbugs.gnu.org
Subject: bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted
Date: Thu, 21 Sep 2023 16:31:04 +0000 [thread overview]
Message-ID: <87jzsjwks7.fsf@posteo.net> (raw)
In-Reply-To: <87led7opd5.fsf@posteo.net> (Philip Kaludercic's message of "Fri, 15 Sep 2023 07:41:10 +0000")
Philip Kaludercic <philipk@posteo.net> writes:
> Stefan Kangas <stefankangas@gmail.com> writes:
>
>> Philip Kaludercic <philipk@posteo.net> writes:
>>
>>> How does this look like:
>>
>> Thanks, some comments below:
>>
>>> From e865604c6a9d06cb986752e28b9ae88d7bc8011e Mon Sep 17 00:00:00 2001
>>> From: Philip Kaludercic <philipk@posteo.net>
>>> Date: Thu, 14 Sep 2023 15:09:19 +0200
>>> Subject: [PATCH] package-tests.el: Add test Bug#65475
>>>
>>> * test/lisp/emacs-lisp/package-tests.el (with-package-test): Bind
>>> package-selected-packages.
>>> (package-test-bug65475): Add test.
>>> ---
>>> test/lisp/emacs-lisp/package-tests.el | 18 ++++++++++++++++++
>>> 1 file changed, 18 insertions(+)
>>>
>>> diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el
>>> index 113b4ec12a8..b55254bc036 100644
>>> --- a/test/lisp/emacs-lisp/package-tests.el
>>> +++ b/test/lisp/emacs-lisp/package-tests.el
>>> @@ -125,6 +125,7 @@ with-package-test
>>> abbreviated-home-dir
>>> package--initialized
>>> package-alist
>>> + package-selected-packages
>>> ,@(if update-news
>>> '(package-update-news-on-upload t)
>>> (list (cl-gensym)))
>>> @@ -307,6 +308,23 @@ package-test-bug58367
>>> (package-delete (cadr (assq 'v7-withsub package-alist))))
>>> ))
>>>
>>> +(ert-deftest package-test-bug65475 ()
>>> + "Ensure deleting a package clears `package-selected-packages'."
>> ^^^^^^ (1) ^^^^^^^^^ (2)
>>
>> 1. Is this word redundant?
>> 2. Maybe: "the last package"?
>
> Makes sense.
>
>>> + (with-package-test (:basedir (ert-resource-directory))
>>> + (package-initialize)
>>> + (let* ((pkg-el "simple-single-1.3.el")
>>> + (source-file (expand-file-name pkg-el (ert-resource-directory))))
>>> + (should-not package-alist)
>>> + (should-not package-selected-packages)
>>> + (package-install-file source-file)
>>> + (should package-alist)
>>> + (should package-selected-packages)
>>> + (let ((desc (cadr (assq 'simple-single package-alist))))
>>> + (should desc)
>>> + (package-delete desc))
>>
>> I'm not sure that the `should's and `should-not's above help, because
>> they make the intention of this test case less clear. For example, the
>> test fails if installing the package fails, but don't we already have a
>> separate test for that? Do we really need this test to fail in that
>> case also?
>>
>> If we want to check that, as a precondition, `package-alist' and
>> `package-selected-packages' are empty, perhaps that should be some
>> `cl-assert's in the `with-package-test' macro? OTOH, we already know
>> it's nil because of the let in the macro, so wouldn't that just be
>> verifying that let-binding a variable works correctly?
>>
>> It seems like the relevant `should's for this particular test are the
>> two below:
>
> No, I think it should be OK to drop the first two, I just wasn't
> familiar with the `with-package-test' at first when writing the test.
> Here is the updated patch:
>
>>From 2354b56a8913294088cb3c9b9c3c833f00fdca91 Mon Sep 17 00:00:00 2001
> From: Philip Kaludercic <philipk@posteo.net>
> Date: Thu, 14 Sep 2023 15:09:19 +0200
> Subject: [PATCH] package-tests.el: Add test Bug#65475
>
> * test/lisp/emacs-lisp/package-tests.el (with-package-test): Bind
> package-selected-packages.
> (package-test-bug65475): Add test.
> ---
> test/lisp/emacs-lisp/package-tests.el | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/test/lisp/emacs-lisp/package-tests.el b/test/lisp/emacs-lisp/package-tests.el
> index 113b4ec12a8..e44ad3677d1 100644
> --- a/test/lisp/emacs-lisp/package-tests.el
> +++ b/test/lisp/emacs-lisp/package-tests.el
> @@ -125,6 +125,7 @@ with-package-test
> abbreviated-home-dir
> package--initialized
> package-alist
> + package-selected-packages
> ,@(if update-news
> '(package-update-news-on-upload t)
> (list (cl-gensym)))
> @@ -307,6 +308,21 @@ package-test-bug58367
> (package-delete (cadr (assq 'v7-withsub package-alist))))
> ))
>
> +(ert-deftest package-test-bug65475 ()
> + "Deleting the last package clears `package-selected-packages'."
> + (with-package-test (:basedir (ert-resource-directory))
> + (package-initialize)
> + (let* ((pkg-el "simple-single-1.3.el")
> + (source-file (expand-file-name pkg-el (ert-resource-directory))))
> + (package-install-file source-file)
> + (should package-alist)
> + (should package-selected-packages)
> + (let ((desc (cadr (assq 'simple-single package-alist))))
> + (should desc)
> + (package-delete desc))
> + (should-not package-alist)
> + (should-not package-selected-packages))))
> +
> (ert-deftest package-test-install-file-EOLs ()
> "Install same file multiple time with `package-install-file'
> but with a different end of line convention (bug#48137)."
I have pushed the change, and am closing the bug again. Thanks to
everyone for helping.
prev parent reply other threads:[~2023-09-21 16:31 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-23 12:02 bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted Andrey Samsonov
2023-08-26 7:16 ` Eli Zaretskii
2023-08-26 7:30 ` Philip Kaludercic
2023-08-26 11:57 ` Stefan Kangas
2023-08-26 12:02 ` Philip Kaludercic
2023-08-26 12:07 ` Stefan Kangas
2023-09-02 16:28 ` Stefan Kangas
2023-09-04 3:24 ` Andrey Samsonov
2023-09-04 7:35 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-05 17:10 ` Philip Kaludercic
2023-09-05 17:39 ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-05 22:03 ` Stefan Kangas
2023-09-10 11:57 ` Philip Kaludercic
2023-09-11 2:42 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-13 10:01 ` Philip Kaludercic
2023-09-13 14:35 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-13 14:41 ` Stefan Kangas
2023-09-14 13:09 ` Philip Kaludercic
2023-09-14 14:27 ` Stefan Kangas
2023-09-15 7:41 ` Philip Kaludercic
2023-09-21 16:31 ` Philip Kaludercic [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87jzsjwks7.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=65475-done@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=me@eshelyaron.com \
--cc=monnier@iro.umontreal.ca \
--cc=samsonov.box@gmail.com \
--cc=stefankangas@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.