Skip to content

Commit

Permalink
Support for python3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreDecan committed Dec 29, 2020
1 parent 6a5d4e0 commit 538ab91
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ Changelog
1.6.2 (2020-12-29)
------------------

- (Added) Support for Python 3.9.
- (Fixed) Remove deprecated import from ``collections`` (`#101 <https://github.com/AlexandreDecan/sismic/pull/101>`__).

- (Fixed) Remove deprecated ``threading.isAlive`` used in ``sismic.runner.AsyncRunner``.


1.6.1 (2020-07-10)
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
keywords='statechart state machine interpreter model uml scxml harel',

Expand Down
24 changes: 12 additions & 12 deletions tests/test_runner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from time import sleep
from time import sleep

from sismic.runner import AsyncRunner
from sismic.interpreter import Interpreter
Expand All @@ -26,11 +26,11 @@ class MockedRunner(AsyncRunner):
before_execute = mocker.MagicMock()
after_execute = mocker.MagicMock()
after_run = mocker.MagicMock()

r = MockedRunner(interpreter, interval=0)
yield r
r.stop()

def test_not_yet_started(self, runner):
assert runner.interpreter.configuration == []

Expand All @@ -46,7 +46,7 @@ def test_start(self, runner):
runner.start()
sleep(self.INTERVAL)
assert runner.interpreter.configuration == ['root', 's1']

runner.interpreter.queue('goto s2')
sleep(self.INTERVAL)
assert runner.interpreter.configuration == ['root', 's3']
Expand All @@ -57,15 +57,15 @@ def test_restart_stopped(self, runner):

with pytest.raises(RuntimeError, match='Cannot restart'):
runner.start()

assert not runner.running

def test_start_again(self, runner):
runner.start()

with pytest.raises(RuntimeError, match='already started'):
runner.start()

assert runner.running
runner.stop()
assert not runner.running
Expand All @@ -79,9 +79,9 @@ def test_hooks(self, mocked_runner):
mocked_runner.start()
sleep(self.INTERVAL)
assert len(mocked_runner.before_run.call_args_list) == 1

sleep(self.INTERVAL)

assert len(mocked_runner.before_execute.call_args_list) > 0
assert len(mocked_runner.after_execute.call_args_list) > 0

Expand All @@ -90,7 +90,7 @@ def test_hooks(self, mocked_runner):
sleep(self.INTERVAL)
assert len(mocked_runner.after_run.call_args_list) == 1


def test_final(self, runner):
runner.start()
runner.interpreter.queue('goto s2')
Expand All @@ -100,7 +100,7 @@ def test_final(self, runner):
assert runner.interpreter.final
assert not runner.running
sleep(self.INTERVAL) # Wait for the thread to finish
assert not runner._thread.isAlive()
assert not runner._thread.is_alive()

def test_pause(self, runner):
runner.start()
Expand All @@ -111,7 +111,7 @@ def test_pause(self, runner):
assert runner.paused
assert runner.running
assert runner.interpreter.configuration == ['root', 's1']

runner.interpreter.queue('goto s2')
sleep(self.INTERVAL)
assert runner.interpreter.configuration == ['root', 's1']
Expand All @@ -122,7 +122,7 @@ def test_pause(self, runner):
sleep(self.INTERVAL)
assert runner.interpreter.configuration == ['root', 's3']


def test_state(self, runner):
assert not runner.running
assert not runner.paused
Expand Down

0 comments on commit 538ab91

Please # to comment.