mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
gh-116303: Skip test module dependent tests if test modules are unavailable (#117341)
This commit is contained in:
parent
2ec6bb4111
commit
ea94b3b149
57 changed files with 255 additions and 123 deletions
|
@ -16,17 +16,16 @@ import time
|
|||
import weakref
|
||||
|
||||
try:
|
||||
import _testcapi
|
||||
from _testcapi import with_tp_del
|
||||
from _testcapi import ContainerNoGC
|
||||
except ImportError:
|
||||
_testcapi = None
|
||||
def with_tp_del(cls):
|
||||
class C(object):
|
||||
def __new__(cls, *args, **kwargs):
|
||||
raise TypeError('requires _testcapi.with_tp_del')
|
||||
raise unittest.SkipTest('requires _testcapi.with_tp_del')
|
||||
return C
|
||||
|
||||
try:
|
||||
from _testcapi import ContainerNoGC
|
||||
except ImportError:
|
||||
ContainerNoGC = None
|
||||
|
||||
### Support code
|
||||
|
@ -681,6 +680,7 @@ class GCTests(unittest.TestCase):
|
|||
|
||||
@cpython_only
|
||||
@requires_subprocess()
|
||||
@unittest.skipIf(_testcapi is None, "requires _testcapi")
|
||||
def test_garbage_at_shutdown(self):
|
||||
import subprocess
|
||||
code = """if 1:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue