mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
gh-92820: Skip test_cppext if _ctypes is missing (#92844)
Add @test.support.requires_venv_with_pip decorator.
This commit is contained in:
parent
a487623c6b
commit
ca0cc9c433
3 changed files with 22 additions and 4 deletions
|
@ -2183,3 +2183,20 @@ def clear_ignored_deprecations(*tokens: object) -> None:
|
||||||
if warnings.filters != new_filters:
|
if warnings.filters != new_filters:
|
||||||
warnings.filters[:] = new_filters
|
warnings.filters[:] = new_filters
|
||||||
warnings._filters_mutated()
|
warnings._filters_mutated()
|
||||||
|
|
||||||
|
|
||||||
|
# Skip a test if venv with pip is known to not work.
|
||||||
|
def requires_venv_with_pip():
|
||||||
|
# ensurepip requires zlib to open ZIP archives (.whl binary wheel packages)
|
||||||
|
try:
|
||||||
|
import zlib
|
||||||
|
except ImportError:
|
||||||
|
return unittest.skipIf(True, "venv: ensurepip requires zlib")
|
||||||
|
|
||||||
|
# bpo-26610: pip/pep425tags.py requires ctypes.
|
||||||
|
# gh-92820: setuptools/windows_support.py uses ctypes (setuptools 58.1).
|
||||||
|
try:
|
||||||
|
import ctypes
|
||||||
|
except ImportError:
|
||||||
|
ctypes = None
|
||||||
|
return unittest.skipUnless(ctypes, 'venv: pip requires ctypes')
|
||||||
|
|
|
@ -19,6 +19,8 @@ class TestCPPExt(unittest.TestCase):
|
||||||
# With MSVC, the linker fails with: cannot open file 'python311.lib'
|
# With MSVC, the linker fails with: cannot open file 'python311.lib'
|
||||||
# https://github.com/python/cpython/pull/32175#issuecomment-1111175897
|
# https://github.com/python/cpython/pull/32175#issuecomment-1111175897
|
||||||
@unittest.skipIf(MS_WINDOWS, 'test fails on Windows')
|
@unittest.skipIf(MS_WINDOWS, 'test fails on Windows')
|
||||||
|
# the test uses venv+pip: skip if it's not available
|
||||||
|
@support.requires_venv_with_pip()
|
||||||
def test_build(self):
|
def test_build(self):
|
||||||
# Build in a temporary directory
|
# Build in a temporary directory
|
||||||
with os_helper.temp_cwd():
|
with os_helper.temp_cwd():
|
||||||
|
|
|
@ -16,7 +16,8 @@ import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from test.support import (captured_stdout, captured_stderr, requires_zlib,
|
from test.support import (captured_stdout, captured_stderr, requires_zlib,
|
||||||
skip_if_broken_multiprocessing_synchronize, verbose,
|
skip_if_broken_multiprocessing_synchronize, verbose,
|
||||||
requires_subprocess, is_emscripten)
|
requires_subprocess, is_emscripten,
|
||||||
|
requires_venv_with_pip)
|
||||||
from test.support.os_helper import (can_symlink, EnvironmentVarGuard, rmtree)
|
from test.support.os_helper import (can_symlink, EnvironmentVarGuard, rmtree)
|
||||||
import unittest
|
import unittest
|
||||||
import venv
|
import venv
|
||||||
|
@ -605,9 +606,7 @@ class EnsurePipTest(BaseTest):
|
||||||
if not system_site_packages:
|
if not system_site_packages:
|
||||||
self.assert_pip_not_installed()
|
self.assert_pip_not_installed()
|
||||||
|
|
||||||
# Issue #26610: pip/pep425tags.py requires ctypes
|
@requires_venv_with_pip()
|
||||||
@unittest.skipUnless(ctypes, 'pip requires ctypes')
|
|
||||||
@requires_zlib()
|
|
||||||
def test_with_pip(self):
|
def test_with_pip(self):
|
||||||
self.do_test_with_pip(False)
|
self.do_test_with_pip(False)
|
||||||
self.do_test_with_pip(True)
|
self.do_test_with_pip(True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue