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

Change subject: tests: decorate HttpsCertificateTestCase as expectedFailure if 
THREADING_FREE
......................................................................

tests: decorate HttpsCertificateTestCase as expectedFailure if THREADING_FREE

HttpsCertificateTestCase fails with threading free Python because the
warning is not thrown. Maybe urllib3 or requests is not ready for it.

Bug: T412605
Change-Id: Ic8d27decf38467ea982d16c7d26331cc4ad1b08b
---
M pywikibot/tools/__init__.py
M tests/http_tests.py
2 files changed, 11 insertions(+), 3 deletions(-)

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




diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index af47fdd..9ad6b55 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -68,6 +68,7 @@
     # other tools
     'PYTHON_VERSION',
     'SPHINX_RUNNING',
+    'THREADING_FREE',
     'as_filename',
     'is_ip_address',
     'is_ip_network',
@@ -89,6 +90,11 @@

 PYTHON_VERSION: tuple[int, int, int] = sys.version_info[:3]
 SPHINX_RUNNING: bool = 'sphinx' in sys.modules
+THREADING_FREE: bool
+if PYTHON_VERSION >= (3, 13):
+    THREADING_FREE = not sys._is_gil_enabled()
+else:
+    THREADING_FREE = False


 def is_ip_address(value: str) -> bool:
diff --git a/tests/http_tests.py b/tests/http_tests.py
index e365242..a9a073a 100755
--- a/tests/http_tests.py
+++ b/tests/http_tests.py
@@ -8,6 +8,7 @@
 from __future__ import annotations

 import re
+import unittest
 import warnings
 from contextlib import suppress
 from http import HTTPStatus
@@ -19,9 +20,9 @@
 from pywikibot import config
 from pywikibot.comms import http
 from pywikibot.exceptions import FatalServerError, Server504Error
-from pywikibot.tools import PYTHON_VERSION, suppress_warnings
-from tests import join_images_path
-from tests.aspects import HttpbinTestCase, TestCase, require_modules, unittest
+from pywikibot.tools import PYTHON_VERSION, THREADING_FREE, suppress_warnings
+from tests import join_images_path, utils
+from tests.aspects import HttpbinTestCase, TestCase, require_modules


 class HttpTestCase(TestCase):
@@ -84,6 +85,7 @@
                 self.assertEqual(http.get_authentication(url), auth)


[email protected]_failure_if(THREADING_FREE)  # T412603
 class HttpsCertificateTestCase(TestCase):

     """HTTPS certificate test."""

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