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

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

Suppress ResourceWarning for PyPy in TestTerminalInput

Also fix login_tests-ci.yml github action

Bug: T401187
Change-Id: Ic5956342bf7d04d3e4a56847faa1a9e4efdd6d53
---
M .github/workflows/login_tests-ci.yml
M tests/ui_tests.py
2 files changed, 15 insertions(+), 7 deletions(-)

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




diff --git a/.github/workflows/login_tests-ci.yml 
b/.github/workflows/login_tests-ci.yml
index a8e35f1..de09d81 100644
--- a/.github/workflows/login_tests-ci.yml
+++ b/.github/workflows/login_tests-ci.yml
@@ -21,7 +21,7 @@
       - name: Wait for all workflows to complete excluding this one
         uses: kachick/[email protected]
         with:
-          skip_same_workflow: true
+          skip-same-workflow: true
           warmup-delay: PT1M
           minimum-interval: PT5M
           fail-on-error: false
diff --git a/tests/ui_tests.py b/tests/ui_tests.py
index dc3daa3..a743e4a 100755
--- a/tests/ui_tests.py
+++ b/tests/ui_tests.py
@@ -10,8 +10,9 @@
 import io
 import logging
 import os
+import platform
 import unittest
-from contextlib import redirect_stdout, suppress
+from contextlib import nullcontext, redirect_stdout, suppress
 from typing import NoReturn
 from unittest.mock import patch

@@ -26,6 +27,7 @@
     VERBOSE,
     WARNING,
 )
+from pywikibot.tools import suppress_warnings
 from pywikibot.userinterfaces import (
     terminal_interface_base,
     terminal_interface_unix,
@@ -242,12 +244,18 @@
         self.assertEqual(returned, 'n')

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

-        self.assertEqual(self.strerr.getvalue(), self.input_choice_output)
-        self.assertEqual(returned, 'n')
+            self.assertEqual(self.strerr.getvalue(), self.input_choice_output)
+            self.assertEqual(returned, 'n')

     def testInputChoiceIncorrectAnswer(self) -> None:
         self.strin.write('X\nN\n')

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