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."""

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1041851?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I368a936ce35e3eb0e958b0cd3815181d381c2296
Gerrit-Change-Number: 1041851
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to