def test_heur_memory(): if is_optimized_mode(): pytest.skip() def inner(): s = Model() heuristic = MyHeur() s.includeHeur(heuristic, "PyHeur", "custom heuristic implemented in python", "Y", timingmask=SCIP_HEURTIMING.BEFORENODE) return weakref.proxy(heuristic) heur_prox = inner() gc.collect() # necessary? with pytest.raises(ReferenceError): heur_prox.name assert is_memory_freed()
def is_optimized_mode(): s = Model() return is_memory_freed()
def test_not_freed(): if is_optimized_mode(): pytest.skip() m = Model() assert not is_memory_freed()