forked from pool/python-transitions
- Add support for Python 3.10 * transitions-fixpy310.patch -- gh#pytransitions/transitions#559 - Make sure the graphviz tests don't error out without an installed font - Clean obsolete python36 conditionals OBS-URL: https://build.opensuse.org/request/show/945691 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-transitions?expand=0&rev=19
49 lines
2.4 KiB
Diff
49 lines
2.4 KiB
Diff
|
|
Index: transitions-0.8.10/tests/test_async.py
|
|
===================================================================
|
|
--- transitions-0.8.10.orig/tests/test_async.py
|
|
+++ transitions-0.8.10/tests/test_async.py
|
|
@@ -130,9 +130,6 @@ class TestAsync(TestTransitions):
|
|
self.assertTrue(mock.called)
|
|
|
|
def test_multiple_models(self):
|
|
- loop = asyncio.new_event_loop()
|
|
- asyncio.set_event_loop(loop)
|
|
-
|
|
m1 = self.machine_cls(states=['A', 'B', 'C'], initial='A', name="m1")
|
|
m2 = self.machine_cls(states=['A'], initial='A', name='m2')
|
|
m1.add_transition(trigger='go', source='A', dest='B', before=self.cancel_soon)
|
|
@@ -141,12 +138,13 @@ class TestAsync(TestTransitions):
|
|
m1.add_transition(trigger='reset', source='C', dest='A')
|
|
m2.add_transition(trigger='go', source='A', dest=None, conditions=m1.is_C, after=m1.reset)
|
|
|
|
- loop.run_until_complete(asyncio.gather(m1.go(), # should block before B
|
|
- self.call_delayed(m1.fix, 0.05), # should cancel task and go to C
|
|
- self.call_delayed(m1.check, 0.07), # should exit before m1.fix
|
|
- self.call_delayed(m2.go, 0.1))) # should cancel m1.fix
|
|
- assert m1.is_A()
|
|
- loop.close()
|
|
+ async def run():
|
|
+ _ = asyncio.gather(m1.go(), # should block before B
|
|
+ self.call_delayed(m1.fix, 0.05), # should cancel task and go to C
|
|
+ self.call_delayed(m1.check, 0.07), # should exit before m1.fix
|
|
+ self.call_delayed(m2.go, 0.1)) # should cancel m1.fix
|
|
+ assert m1.is_A()
|
|
+ asyncio.run(run())
|
|
|
|
def test_async_callback_arguments(self):
|
|
|
|
Index: transitions-0.8.10/transitions/extensions/states.py
|
|
===================================================================
|
|
--- transitions-0.8.10.orig/transitions/extensions/states.py
|
|
+++ transitions-0.8.10/transitions/extensions/states.py
|
|
@@ -96,7 +96,7 @@ class Timeout(State):
|
|
"""
|
|
if self.timeout > 0:
|
|
timer = Timer(self.timeout, self._process_timeout, args=(event_data,))
|
|
- timer.setDaemon(True)
|
|
+ timer.daemon = True
|
|
timer.start()
|
|
self.runner[id(event_data.model)] = timer
|
|
return super(Timeout, self).enter(event_data)
|