jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1193568?usp=email )

Change subject: [bugfix] finally reset messages in 
DeprecationTestCase.assertOneDeprecation
......................................................................

[bugfix] finally reset messages in DeprecationTestCase.assertOneDeprecation

Bug: T406428
Change-Id: I03cbae772e30c89460e4e546a8aaf6522e1292bb
---
M tests/aspects.py
1 file changed, 9 insertions(+), 7 deletions(-)

Approvals:
  jenkins-bot: Verified
  Xqt: Looks good to me, approved




diff --git a/tests/aspects.py b/tests/aspects.py
index b691abc..e980ea9 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -1666,13 +1666,15 @@

     def assertOneDeprecation(self, msg=None, count=1) -> None:
         """Assert that exactly one deprecation message happened and reset."""
-        self.assertDeprecation(msg)
-        # This is doing such a weird structure, so that it shows any other
-        # deprecation message from the set.
-        self.assertCountEqual(set(self.deprecation_messages),
-                              [self.deprecation_messages[0]])
-        self.assertLength(self.deprecation_messages, count)
-        self._reset_messages()
+        try:
+            self.assertDeprecation(msg)
+            # This is doing such a weird structure, so that it shows any other
+            # deprecation message from the set.
+            self.assertCountEqual(set(self.deprecation_messages),
+                                  [self.deprecation_messages[0]])
+            self.assertLength(self.deprecation_messages, count)
+        finally:
+            self._reset_messages()

     def assertNoDeprecation(self, msg=None) -> None:
         """Assert that no deprecation warning happened."""

--
To view, visit 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1193568?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: I03cbae772e30c89460e4e546a8aaf6522e1292bb
Gerrit-Change-Number: 1193568
Gerrit-PatchSet: 1
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