Skip to content

Commit

Permalink
tests: run the gc for 3.13+
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed May 23, 2024
1 parent 1634f06 commit fe8a3ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/test_factory_constructors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import gc
import re

import pytest
Expand Down Expand Up @@ -209,6 +210,7 @@ def get(self):
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

Expand Down Expand Up @@ -288,9 +290,11 @@ def get(self):
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

Expand Down
3 changes: 3 additions & 0 deletions tests/test_virtual_functions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import gc

import pytest

import env # noqa: F401
Expand Down Expand Up @@ -81,6 +83,7 @@ def get_string2(self):
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
Expand Down

0 comments on commit fe8a3ce

Please sign in to comment.