tests: run the gc for 3.13+

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
Henry Schreiner 2024-05-23 01:57:53 -04:00
parent 1634f060f7
commit fe8a3ce3d1
No known key found for this signature in database
GPG Key ID: B9D0E45146A241E8
2 changed files with 7 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import gc
import re
import pytest
@ -209,6 +210,7 @@ def test_init_factory_alias():
assert ConstructorStats.detail_reg_inst() == n_inst + 3
assert [i.alive() for i in cstats] == [3, 3]
del x, y, z
gc.collect()
assert [i.alive() for i in cstats] == [0, 0]
assert ConstructorStats.detail_reg_inst() == n_inst
@ -288,9 +290,11 @@ def test_init_factory_dual():
assert ConstructorStats.detail_reg_inst() == n_inst + 13
del a1, a2, b1, d1, e1, e2
gc.collect()
assert [i.alive() for i in cstats] == [7, 4]
assert ConstructorStats.detail_reg_inst() == n_inst + 7
del b2, c1, c2, d2, f1, f2, g1
gc.collect()
assert [i.alive() for i in cstats] == [0, 0]
assert ConstructorStats.detail_reg_inst() == n_inst

View File

@ -1,3 +1,5 @@
import gc
import pytest
import env # noqa: F401
@ -81,6 +83,7 @@ def test_override(capture, msg):
cstats = ConstructorStats.get(m.ExampleVirt)
assert cstats.alive() == 3
del ex12, ex12p, ex12p2
gc.collect() # Python 3.13 incremental gc needs this
assert cstats.alive() == 0
assert cstats.values() == ["10", "11", "17"]
assert cstats.copy_constructions == 0