15
0

Accepting request 945691 from home:bnavigator:branches:devel:languages:python

- 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
This commit is contained in:
2022-01-13 12:41:18 +00:00
committed by Git OBS Bridge
parent ff4976a970
commit 0523109636
3 changed files with 65 additions and 6 deletions

View File

@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Tue Jan 11 21:26:06 UTC 2022 - Ben Greiner <code@bnavigator.de>
- 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
-------------------------------------------------------------------
Sun Oct 24 17:34:22 UTC 2021 - Ben Greiner <code@bnavigator.de>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-transitions
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2019-2021, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
@@ -27,6 +27,8 @@ License: MIT
Group: Development/Languages/Python
URL: https://github.com/pytransitions/transitions
Source: https://files.pythonhosted.org/packages/source/t/transitions/transitions-%{version}.tar.gz
# PATCH-FIX-UPSTREAM transitions-fixpy310.patch -- gh#pytransitions/transitions#559
Patch0: transitions-fixpy310.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
@@ -36,17 +38,17 @@ Suggests: python-pytest
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module dill}
BuildRequires: %{python_module graphviz}
BuildRequires: %{python_module pycodestyle}
BuildRequires: %{python_module pygraphviz}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module six}
# pygraphviz dropped support for Python 3.6
BuildRequires: %{python_module graphviz if (%python-base without python36-base)}
BuildRequires: %{python_module pygraphviz if (%python-base without python36-base)}
%if %{with python2}
BuildRequires: python2-mock
%endif
# png support for graphviz
BuildRequires: graphviz-gnome
BuildRequires: noto-sans-fonts
# /SECTION
%python_subpackages
@@ -55,7 +57,7 @@ The transitions package makes it convenient and relatively easy to define and
implement FSMs (finite state machines) in python.
%prep
%setup -q -n transitions-%{version}
%autosetup -p 1 -n transitions-%{version}
find . -type f -exec chmod -x {} \;
sed -i 's/\r$//' LICENSE Changelog.md README.md
@@ -67,7 +69,7 @@ sed -i 's/\r$//' LICENSE Changelog.md README.md
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest --ignore tests/test_codestyle.py
%pytest -k "not TestCodeFormat"
%files %{python_files}
%license LICENSE

View File

@@ -0,0 +1,48 @@
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)