Skip to content

All tests in test_bigmem.py are skipped if _testcapi is not available #152168

Description

@ShaharNaveh

Bug report

Bug description:

This line:

_testcapi = import_helper.import_module('_testcapi')

causes the entire test module to be skipped if _testcapi isn't available but, the only test requiring it is:

class ImmortalityTest(unittest.TestCase):
@bigmemtest(size=_2G, memuse=pointer_size * 9/8)
def test_stickiness(self, size):
"""Check that immortality is "sticky", so that
once an object is immortal it remains so."""
if size < _2G:
# Not enough memory to cause immortality on overflow
return
o1 = o2 = o3 = o4 = o5 = o6 = o7 = o8 = object()
l = [o1] * (size-20)
self.assertFalse(_testcapi.is_immortal(o1))
for _ in range(30):
l.append(l[0])
self.assertTrue(_testcapi.is_immortal(o1))
del o2, o3, o4, o5, o6, o7, o8
self.assertTrue(_testcapi.is_immortal(o1))
del l
self.assertTrue(_testcapi.is_immortal(o1))

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions