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

Change subject: Suppress ResourceWarning for PyPy in 
TestTerminalInput.test_input_yn
......................................................................

Suppress ResourceWarning for PyPy in TestTerminalInput.test_input_yn

Bug: T402080
Change-Id: If820e5b3610fba22fc49d28343c5762490b7144e
---
M tests/ui_tests.py
1 file changed, 14 insertions(+), 6 deletions(-)

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




diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index a743e4a..ebfc695 100755
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -207,13 +207,21 @@
         self.assertEqual(returned, 'input to read')

     def test_input_yn(self) -> None:
-        self.strin.write('\n')
-        self.strin.seek(0)
-        returned = pywikibot.input_yn('question', False, automatic_quit=False)
+        if platform.python_implementation() == 'PyPy':
+            context = suppress_warnings(r'subprocess \d+ is still running',
+                                        ResourceWarning)
+        else:
+            context = nullcontext()
+        with context:
+            self.strin.write('\n')
+            self.strin.seek(0)
+            returned = pywikibot.input_yn('question', False,
+                                          automatic_quit=False)

-        self.assertEqual(self.strout.getvalue(), '')
-        self.assertEqual(self.strerr.getvalue(), 'question ([y]es, [N]o): ')
-        self.assertFalse(returned)
+            self.assertEqual(self.strout.getvalue(), '')
+            self.assertEqual(self.strerr.getvalue(),
+                             'question ([y]es, [N]o): ')
+            self.assertFalse(returned)

     def _call_input_choice(self):
         rv = pywikibot.input_choice(

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