[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65475: 29.1; package-selected-packages variable is not updated when
From: |
Philip Kaludercic |
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 |
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.
- bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted, (continued)
- bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted, Eshel Yaron, 2023/09/05
- bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted, Stefan Kangas, 2023/09/05
- bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted, Philip Kaludercic, 2023/09/10
- bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted, Stefan Monnier, 2023/09/10
- bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted, Philip Kaludercic, 2023/09/13
- bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted, Stefan Monnier, 2023/09/13
- bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted, Stefan Kangas, 2023/09/13
- bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted, Philip Kaludercic, 2023/09/14
- bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted, Stefan Kangas, 2023/09/14
- bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted, Philip Kaludercic, 2023/09/15
- bug#65475: 29.1; package-selected-packages variable is not updated when the last package is deleted,
Philip Kaludercic <=