From 11d64d1a06c873a21a20c64d1843e86fee916a9b24fe34b7151d0033f0aba542 Mon Sep 17 00:00:00 2001 From: Benjamin Greiner Date: Fri, 26 Jun 2020 18:02:17 +0000 Subject: [PATCH] Accepting request 817304 from home:bnavigator:branches:devel:languages:python:numeric - move to pytest, ignore deprecation warnings for scipy functions and matrix type during tests gh#python-control/python-control#423 - fix invalid test discovery by pr380-fix-pytest-discovery.patch gh#python-control/python-control#380 - skip mixsyn test on PowerPC boo#1172555 OBS-URL: https://build.opensuse.org/request/show/817304 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-control?expand=0&rev=11 --- pr380-fix-pytest-discovery.patch | 25 +++++++++++++++++++++++++ python-control-rpmlintrc | 1 + python-control.changes | 9 +++++++++ python-control.spec | 30 +++++++++++++++++++++--------- 4 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 pr380-fix-pytest-discovery.patch create mode 100644 python-control-rpmlintrc diff --git a/pr380-fix-pytest-discovery.patch b/pr380-fix-pytest-discovery.patch new file mode 100644 index 0000000..17c2f6b --- /dev/null +++ b/pr380-fix-pytest-discovery.patch @@ -0,0 +1,25 @@ +diff --git a/control/tests/discrete_test.py b/control/tests/discrete_test.py +index f08a5fa5..6598e3a8 100644 +--- a/control/tests/discrete_test.py ++++ b/control/tests/discrete_test.py +@@ -5,7 +5,9 @@ + + import unittest + import numpy as np +-from control import * ++from control import StateSpace, TransferFunction, feedback, step_response, \ ++ isdtime, timebase, isctime, sample_system, bode, impulse_response, \ ++ timebaseEqual, forced_response + from control import matlab + + class TestDiscrete(unittest.TestCase): +@@ -382,9 +384,6 @@ def test_discrete_bode(self): + np.testing.assert_array_almost_equal(mag_out, np.absolute(H_z)) + np.testing.assert_array_almost_equal(phase_out, np.angle(H_z)) + +-def suite(): +- return unittest.TestLoader().loadTestsFromTestCase(TestDiscrete) +- + + if __name__ == "__main__": + unittest.main() diff --git a/python-control-rpmlintrc b/python-control-rpmlintrc new file mode 100644 index 0000000..831e300 --- /dev/null +++ b/python-control-rpmlintrc @@ -0,0 +1 @@ +addFilter("explicit-lib-dependency python3-matplotlib") diff --git a/python-control.changes b/python-control.changes index d54768c..afaed7d 100644 --- a/python-control.changes +++ b/python-control.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Fri Jun 26 15:29:50 UTC 2020 - Benjamin Greiner + +- move to pytest, ignore deprecation warnings for scipy functions + and matrix type during tests gh#python-control/python-control#423 +- fix invalid test discovery by pr380-fix-pytest-discovery.patch + gh#python-control/python-control#380 +- skip mixsyn test on PowerPC boo#1172555 + ------------------------------------------------------------------- Sat Jan 18 01:18:39 UTC 2020 - Benjamin Greiner diff --git a/python-control.spec b/python-control.spec index 4b8412c..eac7e43 100644 --- a/python-control.spec +++ b/python-control.spec @@ -25,11 +25,14 @@ Summary: Python control systems library License: BSD-3-Clause URL: http://python-control.sourceforge.net Source: https://files.pythonhosted.org/packages/source/c/control/control-%{version}.tar.gz +Source1: %{name}-rpmlintrc Patch0: pr365-copy-PR-320-for-robust_array_test.patch Patch1: pr366-ease-precision-tolerance.patch +Patch2: pr380-fix-pytest-discovery.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros +Requires: python-matplotlib Requires: python-numpy Requires: python-scipy Recommends: python-slycot @@ -37,12 +40,12 @@ BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module matplotlib-qt5} BuildRequires: %{python_module matplotlib} -BuildRequires: %{python_module nose} BuildRequires: %{python_module numpy} +BuildRequires: %{python_module pytest-xvfb} +BuildRequires: %{python_module pytest} BuildRequires: %{python_module scipy} BuildRequires: %{python_module slycot} BuildRequires: libjemalloc2 -BuildRequires: xvfb-run # /SECTION %python_subpackages @@ -54,6 +57,9 @@ operations for analysis and design of feedback control systems. %setup -q -n control-%{version} %patch0 -p1 %patch1 -p1 +%patch2 -p1 +#remove shebang +sed -i '1{\@^#!/usr/bin/env python@ d}' control/tests/*.py %build %python_build @@ -64,21 +70,27 @@ operations for analysis and design of feedback control systems. %check # The default Agg backend does not define the toolbar attribute in the Figure -# Manager used by some tests, so we run the tests with the Qt5 backend in a -# virtual X server environment +# Manager used by some tests, so we run the tests with the Qt5 backend +export MPLBACKEND="Qt5Agg" %if %{_arch} == i386 # preload malloc library to avoid free() error on i586 architecture export LD_PRELOAD="%{_libdir}/libjemalloc.so.2" %endif -%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib} -export MPLBACKEND="Qt5Agg" -xvfb-run -a $python setup.py test -} +%if %{_arch} == ppc64 || %{_arch} == ppc64le + %define skiptests -k "not TestMixsyn" +%endif +cat >> setup.cfg <