mirror of
https://github.com/pybind/pybind11.git
synced 2026-04-20 06:49:25 +00:00
test: run pytest under Python devmode (#5715)
* test: run pytest under Python devmode * test: skip segfault bug with 3.14.0b1/2 * test: skip segfault bug with 3.14.0b1/2 * test: unset CMAKE_BUILD_PARALLEL_LEVEL
This commit is contained in:
@@ -206,6 +206,8 @@ def gc_collect():
|
||||
gc.collect()
|
||||
gc.collect()
|
||||
gc.collect()
|
||||
gc.collect()
|
||||
gc.collect()
|
||||
|
||||
|
||||
def pytest_configure():
|
||||
|
||||
@@ -305,11 +305,9 @@ def test_property_rvalue_policy():
|
||||
|
||||
# https://foss.heptapod.net/pypy/pypy/-/issues/2447
|
||||
@pytest.mark.xfail("env.PYPY")
|
||||
@pytest.mark.xfail(
|
||||
sys.version_info == (3, 14, 0, "beta", 1)
|
||||
or sys.version_info == (3, 14, 0, "beta", 2),
|
||||
reason="3.14.0b1/2 bug: https://github.com/python/cpython/issues/133912",
|
||||
strict=True,
|
||||
@pytest.mark.skipif(
|
||||
sys.version_info in ((3, 14, 0, "beta", 1), (3, 14, 0, "beta", 2)),
|
||||
reason="3.14.0b1/2 managed dict bug: https://github.com/python/cpython/issues/133912",
|
||||
)
|
||||
def test_dynamic_attributes():
|
||||
instance = m.DynamicClass()
|
||||
@@ -337,25 +335,31 @@ def test_dynamic_attributes():
|
||||
cstats = ConstructorStats.get(m.DynamicClass)
|
||||
assert cstats.alive() == 1
|
||||
del instance
|
||||
pytest.gc_collect()
|
||||
assert cstats.alive() == 0
|
||||
|
||||
# Derived classes should work as well
|
||||
class PythonDerivedDynamicClass(m.DynamicClass):
|
||||
pass
|
||||
|
||||
for cls in m.CppDerivedDynamicClass, PythonDerivedDynamicClass:
|
||||
for cls in (m.CppDerivedDynamicClass, PythonDerivedDynamicClass):
|
||||
derived = cls()
|
||||
derived.foobar = 100
|
||||
assert derived.foobar == 100
|
||||
|
||||
assert cstats.alive() == 1
|
||||
del derived
|
||||
pytest.gc_collect()
|
||||
assert cstats.alive() == 0
|
||||
|
||||
|
||||
# https://foss.heptapod.net/pypy/pypy/-/issues/2447
|
||||
@pytest.mark.xfail("env.PYPY")
|
||||
@pytest.mark.skipif("env.GRAALPY", reason="Cannot reliably trigger GC")
|
||||
@pytest.mark.skipif(
|
||||
sys.version_info in ((3, 14, 0, "beta", 1), (3, 14, 0, "beta", 2)),
|
||||
reason="3.14.0b1/2 managed dict bug: https://github.com/python/cpython/issues/133912",
|
||||
)
|
||||
def test_cyclic_gc():
|
||||
# One object references itself
|
||||
instance = m.DynamicClass()
|
||||
@@ -364,6 +368,7 @@ def test_cyclic_gc():
|
||||
cstats = ConstructorStats.get(m.DynamicClass)
|
||||
assert cstats.alive() == 1
|
||||
del instance
|
||||
pytest.gc_collect()
|
||||
assert cstats.alive() == 0
|
||||
|
||||
# Two object reference each other
|
||||
@@ -374,6 +379,7 @@ def test_cyclic_gc():
|
||||
|
||||
assert cstats.alive() == 2
|
||||
del i1, i2
|
||||
pytest.gc_collect()
|
||||
assert cstats.alive() == 0
|
||||
|
||||
|
||||
|
||||
@@ -68,11 +68,9 @@ def test_roundtrip(cls_name):
|
||||
[
|
||||
pytest.param(
|
||||
"PickleableWithDict",
|
||||
marks=pytest.mark.xfail(
|
||||
sys.version_info == (3, 14, 0, "beta", 1)
|
||||
or sys.version_info == (3, 14, 0, "beta", 2),
|
||||
reason="3.14.0b1/2 bug: https://github.com/python/cpython/issues/133912",
|
||||
strict=True,
|
||||
marks=pytest.mark.skipif(
|
||||
sys.version_info in ((3, 14, 0, "beta", 1), (3, 14, 0, "beta", 2)),
|
||||
reason="3.14.0b1/2 managed dict bug: https://github.com/python/cpython/issues/133912",
|
||||
),
|
||||
),
|
||||
"PickleableWithDictNew",
|
||||
|
||||
Reference in New Issue
Block a user