[packages/python-pyudev] - updated to 0.21.0 - added mock patch (use standard library unittest.mock instead of external modul

qboosh qboosh at pld-linux.org
Sun Apr 16 12:47:20 CEST 2017


commit 045a8fc93502583b405f4b3e72174e2442279a29
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Apr 16 12:47:31 2017 +0200

    - updated to 0.21.0
    - added mock patch (use standard library unittest.mock instead of external module for python3)

 python-pyudev-mock.patch | 112 +++++++++++++++++++++++++++++++++++++++++++++++
 python-pyudev.spec       |  25 +++++++----
 2 files changed, 128 insertions(+), 9 deletions(-)
---
diff --git a/python-pyudev.spec b/python-pyudev.spec
index d093eb1..95cf0b2 100644
--- a/python-pyudev.spec
+++ b/python-pyudev.spec
@@ -1,7 +1,7 @@
 #
 # Conditional build:
 %bcond_without	doc		# HTML documentation build
-%bcond_with	tests		# test target [requires functional udev with device db]
+%bcond_with	tests		# py.test tests [requires functional udev with device db]
 %bcond_without	python2         # Python 2.x module
 %bcond_without	python3         # Python 3.x module
 #
@@ -9,13 +9,13 @@
 Summary:	Pure Python binding for libudev
 Summary(pl.UTF-8):	Czysto pythonowe wiązanie do libudev
 Name:		python-%{module}
-Version:	0.19.0
-Release:	2
+Version:	0.21.0
+Release:	1
 License:	LGPL v2.1+
 Group:		Development/Languages/Python
 #Source0Download: https://pypi.python.org/simple/pyudev/
-Source0:	https://pypi.python.org/packages/source/p/pyudev/%{module}-%{version}.tar.gz
-# Source0-md5:	1151e9d05baf6ce7b43e7574dc0ef154
+Source0:	https://files.pythonhosted.org/packages/source/p/pyudev/%{module}-%{version}.tar.gz
+# Source0-md5:	cf4d9db7d772622144ca1be6b5d9353b
 #Source1:	http://docs.python.org/2/objects.inv#/python-objects.inv
 Source1:	python-objects.inv
 # Source1-md5:	ad9c579afde0743e007b472cff7f1364
@@ -26,8 +26,8 @@ Source2:	pytest-objects.inv
 Source3:	pyside-objects.inv
 # Source3-md5:	8cc5c1ff0bb5ef9f4e9968c9b4a01984
 Patch0:		%{name}-offline.patch
+Patch1:		%{name}-mock.patch
 URL:		http://pyudev.readthedocs.org/
-BuildRequires:	rpmbuild(macros) >= 1.710
 %if %{with python2}
 BuildRequires:	python-devel >= 1:2.6
 BuildRequires:	python-setuptools
@@ -36,6 +36,7 @@ BuildRequires:	python-docutils >= 0.9
 BuildRequires:	python-hypothesis
 BuildRequires:	python-mock >= 1.0
 BuildRequires:	python-pytest >= 2.8
+BuildRequires:	python-six
 %endif
 %endif
 %if %{with python3}
@@ -44,11 +45,12 @@ BuildRequires:	python3-setuptools
 %if %{with tests}
 BuildRequires:	python3-docutils >= 0.9
 BuildRequires:	python3-hypothesis
-BuildRequires:	python3-mock >= 1.0
 BuildRequires:	python3-pytest >= 2.8
+BuildRequires:	python3-six
 %endif
 %endif
 BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
 %if %{with doc}
 # for tests 1.0b1 is required, but for docs generation 0.8 is sufficient
 BuildRequires:	python-mock >= 0.8
@@ -102,16 +104,21 @@ użyciem wątków albo wewnątrz pętli zdarzeń Qt, GLiba czy wxPythona.
 %prep
 %setup -q -n %{module}-%{version}
 %patch0 -p1
+%patch1 -p1
 
 cp -p %{SOURCE1} %{SOURCE2} %{SOURCE3} doc
 
 %build
 %if %{with python2}
-%py_build %{?with_tests:test}
+%py_build
+
+%{?with_tests:PYTHONPATH=$(pwd):$(pwd)/build-2/lib %{__python} -m pytest tests}
 %endif
 
 %if %{with python3}
-%py3_build %{?with_tests:test}
+%py3_build
+
+%{?with_tests:PYTHONPATH=$(pwd):$(pwd)/build-3/lib %{__python3} -m pytest tests}
 %endif
 
 %if %{with doc}
diff --git a/python-pyudev-mock.patch b/python-pyudev-mock.patch
new file mode 100644
index 0000000..facbf07
--- /dev/null
+++ b/python-pyudev-mock.patch
@@ -0,0 +1,112 @@
+--- pyudev-0.21.0/tests/_device_tests/_device_tests.py.orig	2016-07-21 22:32:53.000000000 +0200
++++ pyudev-0.21.0/tests/_device_tests/_device_tests.py	2017-04-16 12:44:06.869191990 +0200
+@@ -37,7 +37,10 @@ from hypothesis import settings
+ from hypothesis import strategies
+ 
+ import pytest
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ from pyudev import Device
+ from pyudev import Devices
+--- pyudev-0.21.0/tests/_device_tests/_tags_tests.py.orig	2016-07-21 22:32:53.000000000 +0200
++++ pyudev-0.21.0/tests/_device_tests/_tags_tests.py	2017-04-16 12:43:43.242525595 +0200
+@@ -31,7 +31,10 @@ from hypothesis import settings
+ from hypothesis import strategies
+ 
+ import pytest
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ from pyudev import Devices
+ 
+--- pyudev-0.21.0/tests/plugins/mock_libudev.py.orig	2016-02-02 17:19:29.000000000 +0100
++++ pyudev-0.21.0/tests/plugins/mock_libudev.py	2017-04-16 12:43:19.139192536 +0200
+@@ -34,7 +34,10 @@ from operator import attrgetter
+ from contextlib import contextmanager
+ from collections import namedtuple
+ 
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ 
+ Node = namedtuple('Node', 'name value next')
+--- pyudev-0.21.0/tests/test_core.py.orig	2016-04-29 23:17:02.000000000 +0200
++++ pyudev-0.21.0/tests/test_core.py	2017-04-16 12:41:32.362527088 +0200
+@@ -22,7 +22,10 @@ from __future__ import (print_function,
+ import random
+ import syslog
+ 
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ from pyudev import udev_version
+ 
+--- pyudev-0.21.0/tests/test_enumerate.py.orig	2016-07-21 22:32:53.000000000 +0200
++++ pyudev-0.21.0/tests/test_enumerate.py	2017-04-16 12:42:44.235859601 +0200
+@@ -20,7 +20,10 @@ from __future__ import (print_function,
+                         absolute_import)
+ 
+ import pytest
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ from hypothesis import given
+ from hypothesis import settings
+--- pyudev-0.21.0/tests/test_monitor.py.orig	2016-07-21 22:32:53.000000000 +0200
++++ pyudev-0.21.0/tests/test_monitor.py	2017-04-16 12:41:04.209194078 +0200
+@@ -25,7 +25,10 @@ from contextlib import contextmanager
+ from select import select
+ 
+ import pytest
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ from pyudev import Monitor, MonitorObserver, Devices
+ 
+--- pyudev-0.21.0/tests/test_observer_deprecated.py.orig	2016-07-21 22:32:53.000000000 +0200
++++ pyudev-0.21.0/tests/test_observer_deprecated.py	2017-04-16 12:42:18.385859897 +0200
+@@ -19,7 +19,10 @@ from __future__ import (print_function,
+                         absolute_import)
+ 
+ import pytest
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ from pyudev import Monitor, Devices
+ 
+--- pyudev-0.21.0/tests/test_observer.py.orig	2016-07-21 22:32:53.000000000 +0200
++++ pyudev-0.21.0/tests/test_observer.py	2017-04-16 12:41:58.945860118 +0200
+@@ -21,7 +21,10 @@ from __future__ import (print_function,
+ import random
+ 
+ import pytest
+-import mock
++try:
++    from unittest import mock
++except ImportError:
++    import mock
+ 
+ from pyudev import Monitor, Devices
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-pyudev.git/commitdiff/045a8fc93502583b405f4b3e72174e2442279a29



More information about the pld-cvs-commit mailing list