jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1041851?usp=email )
Change subject: [fix] restore saved token wallet in TokenTestBase ......................................................................
[fix] restore saved token wallet in TokenTestBase
Site.token is a property and does not have a setter to prevent changes to the attribute; for tests use the underlying _tokens attribute.
Bug: T367257 Change-Id: I368a936ce35e3eb0e958b0cd3815181d381c2296 --- M tests/token_tests.py 1 file changed, 4 insertions(+), 7 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/token_tests.py b/tests/token_tests.py index b86d005..4a86a57 100755 --- a/tests/token_tests.py +++ b/tests/token_tests.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """Tests for tokens.""" # -# (C) Pywikibot team, 2015-2022 +# (C) Pywikibot team, 2015-2024 # # Distributed under the terms of the MIT license. # @@ -11,7 +11,6 @@ from contextlib import suppress
from pywikibot.exceptions import APIError, Error -from pywikibot.site import TokenWallet from tests.aspects import ( DefaultSiteTestCase, DeprecationTestCase, @@ -71,11 +70,11 @@
self.token = token self._orig_wallet = self.site.tokens - self.site.tokens = TokenWallet(self.site) + self.site.tokens.clear()
def tearDown(self): """Restore site tokens.""" - self.site.tokens = self._orig_wallet + self.site._tokens = self._orig_wallet super().tearDown()
@@ -85,11 +84,9 @@
family = 'wikipedia' code = 'test' - token_type = 'patrol' - - login = True write = True rights = 'patrol' + token_type = 'patrol'
def test_patrol(self): """Test the site.patrol() method."""
pywikibot-commits@lists.wikimedia.org