mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 05:05:11 +00:00
tests: run the gc for 3.13+
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
parent
1634f060f7
commit
fe8a3ce3d1
@ -1,3 +1,4 @@
|
|||||||
|
import gc
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -209,6 +210,7 @@ def test_init_factory_alias():
|
|||||||
assert ConstructorStats.detail_reg_inst() == n_inst + 3
|
assert ConstructorStats.detail_reg_inst() == n_inst + 3
|
||||||
assert [i.alive() for i in cstats] == [3, 3]
|
assert [i.alive() for i in cstats] == [3, 3]
|
||||||
del x, y, z
|
del x, y, z
|
||||||
|
gc.collect()
|
||||||
assert [i.alive() for i in cstats] == [0, 0]
|
assert [i.alive() for i in cstats] == [0, 0]
|
||||||
assert ConstructorStats.detail_reg_inst() == n_inst
|
assert ConstructorStats.detail_reg_inst() == n_inst
|
||||||
|
|
||||||
@ -288,9 +290,11 @@ def test_init_factory_dual():
|
|||||||
assert ConstructorStats.detail_reg_inst() == n_inst + 13
|
assert ConstructorStats.detail_reg_inst() == n_inst + 13
|
||||||
|
|
||||||
del a1, a2, b1, d1, e1, e2
|
del a1, a2, b1, d1, e1, e2
|
||||||
|
gc.collect()
|
||||||
assert [i.alive() for i in cstats] == [7, 4]
|
assert [i.alive() for i in cstats] == [7, 4]
|
||||||
assert ConstructorStats.detail_reg_inst() == n_inst + 7
|
assert ConstructorStats.detail_reg_inst() == n_inst + 7
|
||||||
del b2, c1, c2, d2, f1, f2, g1
|
del b2, c1, c2, d2, f1, f2, g1
|
||||||
|
gc.collect()
|
||||||
assert [i.alive() for i in cstats] == [0, 0]
|
assert [i.alive() for i in cstats] == [0, 0]
|
||||||
assert ConstructorStats.detail_reg_inst() == n_inst
|
assert ConstructorStats.detail_reg_inst() == n_inst
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import gc
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import env # noqa: F401
|
import env # noqa: F401
|
||||||
@ -81,6 +83,7 @@ def test_override(capture, msg):
|
|||||||
cstats = ConstructorStats.get(m.ExampleVirt)
|
cstats = ConstructorStats.get(m.ExampleVirt)
|
||||||
assert cstats.alive() == 3
|
assert cstats.alive() == 3
|
||||||
del ex12, ex12p, ex12p2
|
del ex12, ex12p, ex12p2
|
||||||
|
gc.collect() # Python 3.13 incremental gc needs this
|
||||||
assert cstats.alive() == 0
|
assert cstats.alive() == 0
|
||||||
assert cstats.values() == ["10", "11", "17"]
|
assert cstats.values() == ["10", "11", "17"]
|
||||||
assert cstats.copy_constructions == 0
|
assert cstats.copy_constructions == 0
|
||||||
|
Loading…
Reference in New Issue
Block a user