[Python-checkins] gh-84461: Skip dtrace/network tests that are enabled by -u all (GH-93473)

miss-islington webhook-mailer at python.org
Fri Jun 3 16:40:29 EDT 2022


https://github.com/python/cpython/commit/e4113be63c27faf52c5ce79f1afa3b9f6e33de46
commit: e4113be63c27faf52c5ce79f1afa3b9f6e33de46
branch: 3.11
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-06-03T13:40:20-07:00
summary:

gh-84461: Skip dtrace/network tests that are enabled by -u all (GH-93473)

(cherry picked from commit 1a8a0ddb1c62ef9aff598e7e3e3a65cf35353932)

Co-authored-by: Christian Heimes <christian at python.org>

files:
M Lib/test/support/__init__.py
M Lib/test/test_dtrace.py

diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 513ada7cb1f3d..35c4efb01af27 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -304,6 +304,8 @@ def requires(resource, msg=None):
         if msg is None:
             msg = "Use of the %r resource not enabled" % resource
         raise ResourceDenied(msg)
+    if resource in {"network", "urlfetch"} and not has_socket_support:
+        raise ResourceDenied("No socket support")
     if resource == 'gui' and not _is_gui_available():
         raise ResourceDenied(_is_gui_available.reason)
 
diff --git a/Lib/test/test_dtrace.py b/Lib/test/test_dtrace.py
index 8a436ad123b80..4b971deacc1a5 100644
--- a/Lib/test/test_dtrace.py
+++ b/Lib/test/test_dtrace.py
@@ -6,9 +6,14 @@
 import types
 import unittest
 
+from test import support
 from test.support import findfile
 
 
+if not support.has_subprocess_support:
+    raise unittest.SkipTest("test module requires subprocess")
+
+
 def abspath(filename):
     return os.path.abspath(findfile(filename, subdir="dtracedata"))
 



More information about the Python-checkins mailing list