adjust some python tests to work with PyPy
Part of #467. * tests/python/bdddict.py, tests/python/ltl2tgba.py, tests/python/ltlparse.py, tests/python/ltlsimple.py, tests/python/sccinfo.py, tests/python/simstate.py, tests/python/split.py, tests/python/tra2tba.py: Adjust to deal with a non-refcounted Python implementation.
This commit is contained in:
parent
47348a9755
commit
3d79022abb
8 changed files with 141 additions and 25 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# -*- mode: python; coding: utf-8 -*-
|
||||
# Copyright (C) 2018-2020 Laboratoire de Recherche et
|
||||
# Copyright (C) 2018-2021 Laboratoire de Recherche et
|
||||
# Développement de l'Epita
|
||||
#
|
||||
# This file is part of Spot, a model checking library.
|
||||
|
|
@ -19,6 +19,19 @@
|
|||
|
||||
import spot
|
||||
|
||||
# CPython use reference counting, so that automata are destructed
|
||||
# when we expect them to be. However other implementations like
|
||||
# PyPy may call destructors latter, causing different output.
|
||||
from platform import python_implementation
|
||||
if python_implementation() == 'CPython':
|
||||
def gcollect():
|
||||
pass
|
||||
else:
|
||||
import gc
|
||||
def gcollect():
|
||||
gc.collect()
|
||||
|
||||
|
||||
|
||||
def incl(a, b):
|
||||
return not b.intersects(spot.dualize(spot.tgba_determinize(a)))
|
||||
|
|
@ -50,6 +63,10 @@ def str_diff(expect, obtained):
|
|||
aut, s = do_split('(FG !a) <-> (GF b)', ['a'], ['b'])
|
||||
assert equiv(aut, spot.unsplit_2step(s))
|
||||
|
||||
del aut
|
||||
del s
|
||||
gcollect()
|
||||
|
||||
aut, s = do_split('GFa && GFb', ['a'], ['b'])
|
||||
assert equiv(aut, spot.unsplit_2step(s))
|
||||
assert str_diff("""HOA: v1
|
||||
|
|
@ -73,6 +90,10 @@ State: 2
|
|||
[1] 0 {1}
|
||||
--END--""", s.to_str() )
|
||||
|
||||
del aut
|
||||
del s
|
||||
gcollect()
|
||||
|
||||
aut, s = do_split('! ((G (req -> (F ack))) && (G (go -> (F grant))))',
|
||||
['go', 'req'], ['ack'])
|
||||
assert equiv(aut, spot.unsplit_2step(s))
|
||||
|
|
@ -113,6 +134,10 @@ assert equiv(aut, spot.unsplit_2step(s))
|
|||
# [!3] 2
|
||||
# --END--"""
|
||||
|
||||
del aut
|
||||
del s
|
||||
gcollect()
|
||||
|
||||
aut, s = do_split('((G (((! g_0) || (! g_1)) && ((r_0 && (X r_1)) -> (F (g_0 \
|
||||
&& g_1))))) && (G (r_0 -> F g_0))) && (G (r_1 -> F g_1))',
|
||||
['r_0', 'r_1'], ['g_0', 'g_1'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue