diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 42e7b876594fa7..d5e2ff50b694ec 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -44,6 +44,7 @@ # sys "MS_WINDOWS", "is_jython", "is_android", "is_emscripten", "is_wasi", "is_apple_mobile", "check_impl_detail", "unix_shell", "setswitchinterval", + "has_runtime_library", # os "get_pagesize", # network @@ -536,6 +537,8 @@ def skip_android_selinux(name): is_emscripten = sys.platform == "emscripten" is_wasi = sys.platform == "wasi" +has_runtime_library = bool(hasattr(sys, 'dllhandle') or sysconfig.get_config_var('LD_LIBRARY')) + def skip_emscripten_stack_overflow(): return unittest.skipIf(is_emscripten, "Exhausts limited stack on Emscripten") diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 7110fb889f3c8e..111add99d9607e 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -1,7 +1,9 @@ # Run the tests in Programs/_testembed.c (tests for the CPython embedding APIs) from test import support from test.libregrtest.utils import get_build_info -from test.support import import_helper, os_helper, threading_helper, MS_WINDOWS +from test.support import ( + import_helper, os_helper, threading_helper, MS_WINDOWS, has_runtime_library +) import unittest from collections import namedtuple @@ -1608,6 +1610,7 @@ def test_init_pybuilddir_win32(self): api=API_COMPAT, env=env, ignore_stderr=False, cwd=tmpdir) + @unittest.skipIf(has_runtime_library, "Test only available when static linking libpython") def test_init_pyvenv_cfg(self): # Test path configuration with pyvenv.cfg configuration file