diff --git a/CHANGELOG.rst b/CHANGELOG.rst index fe69d50..db9ae28 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,8 +5,9 @@ Changelog 1.6.2 (2020-12-29) ------------------ + - (Added) Support for Python 3.9. - (Fixed) Remove deprecated import from ``collections`` (`#101 `__). - + - (Fixed) Remove deprecated ``threading.isAlive`` used in ``sismic.runner.AsyncRunner``. 1.6.1 (2020-07-10) diff --git a/setup.py b/setup.py index 644312a..d61ce73 100644 --- a/setup.py +++ b/setup.py @@ -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', diff --git a/tests/test_runner.py b/tests/test_runner.py index a6d9d8e..62ecee2 100644 --- a/tests/test_runner.py +++ b/tests/test_runner.py @@ -1,6 +1,6 @@ import pytest -from time import sleep +from time import sleep from sismic.runner import AsyncRunner from sismic.interpreter import Interpreter @@ -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 == [] @@ -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'] @@ -57,7 +57,7 @@ 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): @@ -65,7 +65,7 @@ def test_start_again(self, runner): with pytest.raises(RuntimeError, match='already started'): runner.start() - + assert runner.running runner.stop() assert not runner.running @@ -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 @@ -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') @@ -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() @@ -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'] @@ -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