[packages/python-flaky] - updated tests running (no deprecated setuptools test command, tox not required) - updated tests de
qboosh
qboosh at pld-linux.org
Mon Jan 13 16:10:22 CET 2020
commit c55eb3152a11a81a1557317f491e718038259f38
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Mon Jan 13 16:10:12 2020 +0100
- updated tests running (no deprecated setuptools test command, tox not required)
- updated tests depencies, added mock patch not to require python3-mock; but tests still fail
python-flaky-mock.patch | 32 ++++++++++++++++++++++++++++++++
python-flaky.spec | 22 +++++++++++++++++-----
2 files changed, 49 insertions(+), 5 deletions(-)
---
diff --git a/python-flaky.spec b/python-flaky.spec
index 28c1813..910dc55 100644
--- a/python-flaky.spec
+++ b/python-flaky.spec
@@ -1,6 +1,6 @@
#
# Conditional build:
-%bcond_with tests # unit tests (tox required)
+%bcond_with tests # unit tests (many failures)
%bcond_without python2 # CPython 2.x module
%bcond_without python3 # CPython 3.x module
@@ -14,21 +14,23 @@ Group: Libraries/Python
#Source0Download: https://pypi.org/simple/flaky/
Source0: https://files.pythonhosted.org/packages/source/f/flaky/flaky-%{version}.tar.gz
# Source0-md5: 7427c11cd74e8851f1d7bf2690b646b5
+Patch0: %{name}-mock.patch
URL: https://pypi.org/project/flaky/
%if %{with python2}
BuildRequires: python-modules >= 1:2.7
BuildRequires: python-setuptools
%if %{with tests}
+BuildRequires: python-genty
+BuildRequires: python-mock
BuildRequires: python-pytest
-BuildRequires: python-tox
%endif
%endif
%if %{with python3}
BuildRequires: python3-modules >= 1:3.4
BuildRequires: python3-setuptools
%if %{with tests}
+BuildRequires: python3-genty
BuildRequires: python3-pytest
-BuildRequires: python3-tox
%endif
%endif
BuildRequires: rpm-pythonprov
@@ -81,14 +83,24 @@ testów lub oznaczania ich @skip, można je automatycznie ponowić.
%prep
%setup -q -n flaky-%{version}
+%patch0 -p1
%build
%if %{with python2}
-%py_build %{?with_tests:test}
+%py_build
+
+%if %{with tests}
+LC_ALL=C.UTF-8 \
+%{__python} -m unittest discover -s test
+%endif
%endif
%if %{with python3}
-%py3_build %{?with_tests:test}
+%py3_build
+
+%if %{with tests}
+%{__python3} -m unittest discover -s test
+%endif
%endif
%install
diff --git a/python-flaky-mock.patch b/python-flaky-mock.patch
new file mode 100644
index 0000000..5ed31d7
--- /dev/null
+++ b/python-flaky-mock.patch
@@ -0,0 +1,32 @@
+--- flaky-3.6.1/test/test_nose/test_flaky_nose_plugin.py.orig 2019-01-09 18:29:18.000000000 +0100
++++ flaky-3.6.1/test/test_nose/test_flaky_nose_plugin.py 2020-01-13 16:06:51.602083798 +0100
+@@ -5,8 +5,12 @@
+ from unittest import TestCase
+
+ from genty import genty, genty_dataset
+-import mock
+-from mock import MagicMock, Mock, patch
++try:
++ import mock
++ from mock import MagicMock, Mock, patch
++except ImportError:
++ from unittest import mock
++ from unittest.mock import MagicMock, Mock, patch
+
+ from flaky import defaults, flaky_nose_plugin
+ from flaky.flaky_decorator import flaky
+--- flaky-3.6.1/test/test_pytest/test_flaky_pytest_plugin.py.orig 2019-08-06 20:25:51.000000000 +0200
++++ flaky-3.6.1/test/test_pytest/test_flaky_pytest_plugin.py 2020-01-13 16:07:18.311939098 +0100
+@@ -2,7 +2,11 @@
+
+ from __future__ import unicode_literals
+ from io import StringIO
+-from mock import Mock, patch
++try:
++ from mock import Mock, patch
++except ImportError:
++ from unittest.mock import Mock, patch
++
+ # pylint:disable=import-error
+ import pytest
+ from _pytest.runner import CallInfo
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-flaky.git/commitdiff/c55eb3152a11a81a1557317f491e718038259f38
More information about the pld-cvs-commit
mailing list