@@ -305,11 +305,9 @@ def test_property_rvalue_policy():
305305
306306# https://foss.heptapod.net/pypy/pypy/-/issues/2447
307307@pytest .mark .xfail ("env.PYPY" )
308- @pytest .mark .xfail (
309- sys .version_info == (3 , 14 , 0 , "beta" , 1 )
310- or sys .version_info == (3 , 14 , 0 , "beta" , 2 ),
311- reason = "3.14.0b1/2 bug: https://github.com/python/cpython/issues/133912" ,
312- strict = True ,
308+ @pytest .mark .skipif (
309+ sys .version_info in ((3 , 14 , 0 , "beta" , 1 ), (3 , 14 , 0 , "beta" , 2 )),
310+ reason = "3.14.0b1/2 managed dict bug: https://github.com/python/cpython/issues/133912" ,
313311)
314312def test_dynamic_attributes ():
315313 instance = m .DynamicClass ()
@@ -337,25 +335,31 @@ def test_dynamic_attributes():
337335 cstats = ConstructorStats .get (m .DynamicClass )
338336 assert cstats .alive () == 1
339337 del instance
338+ pytest .gc_collect ()
340339 assert cstats .alive () == 0
341340
342341 # Derived classes should work as well
343342 class PythonDerivedDynamicClass (m .DynamicClass ):
344343 pass
345344
346- for cls in m .CppDerivedDynamicClass , PythonDerivedDynamicClass :
345+ for cls in ( m .CppDerivedDynamicClass , PythonDerivedDynamicClass ) :
347346 derived = cls ()
348347 derived .foobar = 100
349348 assert derived .foobar == 100
350349
351350 assert cstats .alive () == 1
352351 del derived
352+ pytest .gc_collect ()
353353 assert cstats .alive () == 0
354354
355355
356356# https://foss.heptapod.net/pypy/pypy/-/issues/2447
357357@pytest .mark .xfail ("env.PYPY" )
358358@pytest .mark .skipif ("env.GRAALPY" , reason = "Cannot reliably trigger GC" )
359+ @pytest .mark .skipif (
360+ sys .version_info in ((3 , 14 , 0 , "beta" , 1 ), (3 , 14 , 0 , "beta" , 2 )),
361+ reason = "3.14.0b1/2 managed dict bug: https://github.com/python/cpython/issues/133912" ,
362+ )
359363def test_cyclic_gc ():
360364 # One object references itself
361365 instance = m .DynamicClass ()
@@ -364,6 +368,7 @@ def test_cyclic_gc():
364368 cstats = ConstructorStats .get (m .DynamicClass )
365369 assert cstats .alive () == 1
366370 del instance
371+ pytest .gc_collect ()
367372 assert cstats .alive () == 0
368373
369374 # Two object reference each other
@@ -374,6 +379,7 @@ def test_cyclic_gc():
374379
375380 assert cstats .alive () == 2
376381 del i1 , i2
382+ pytest .gc_collect ()
377383 assert cstats .alive () == 0
378384
379385
0 commit comments