forked from pool/python-pyudev
Accepting request 855370 from home:bnavigator:branches:devel:languages:python
- Add remove_mock.patch gh#pyudev/pyudev#409 - Static linting with pylint is not needed for unit tests or build OBS-URL: https://build.opensuse.org/request/show/855370 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyudev?expand=0&rev=40
This commit is contained in:
parent
eaf67e9e65
commit
7866c35105
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Sat Dec 12 13:12:21 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
|
||||
|
||||
- Add remove_mock.patch gh#pyudev/pyudev#409
|
||||
- Static linting with pylint is not needed for unit tests or build
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 8 23:03:04 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
|
@ -28,6 +28,8 @@ Source0: https://files.pythonhosted.org/packages/source/p/pyudev/pyudev-%
|
||||
# PATCH-FIX-UPSTREAM pytest_register_mark.patch gh#pyudev/pyudev#404 mcepl@suse.com
|
||||
# Add missing mark registration and register and use another mark
|
||||
Patch0: pytest_register_mark.patch
|
||||
# PATCH-FEATURE_UPSTREAM remove_mock.patch gh#pyudev/pyudev#409
|
||||
Patch1: remove_mock.patch
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module six}
|
||||
BuildRequires: fdupes
|
||||
@ -41,11 +43,12 @@ BuildArch: noarch
|
||||
BuildRequires: %{python_module Sphinx}
|
||||
BuildRequires: %{python_module docutils}
|
||||
BuildRequires: %{python_module hypothesis}
|
||||
BuildRequires: %{python_module mock}
|
||||
BuildRequires: %{python_module pylint}
|
||||
BuildRequires: %{python_module pytest}
|
||||
BuildRequires: %{python_module six}
|
||||
BuildRequires: %{python_module yapf}
|
||||
%if 0%{?suse_version} < 1550
|
||||
BuildRequires: python-mock
|
||||
%endif
|
||||
%ifpython2
|
||||
# pyudev was last used in KDE:Unstable:Playground (pyudev-0.8)
|
||||
Provides: pyudev = %{version}
|
||||
|
179
remove_mock.patch
Normal file
179
remove_mock.patch
Normal file
@ -0,0 +1,179 @@
|
||||
Index: pyudev-0.22.0/tests/_device_tests/_device_tests.py
|
||||
===================================================================
|
||||
--- pyudev-0.22.0.orig/tests/_device_tests/_device_tests.py
|
||||
+++ pyudev-0.22.0/tests/_device_tests/_device_tests.py
|
||||
@@ -36,7 +36,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
|
||||
Index: pyudev-0.22.0/tests/_device_tests/_tags_tests.py
|
||||
===================================================================
|
||||
--- pyudev-0.22.0.orig/tests/_device_tests/_tags_tests.py
|
||||
+++ pyudev-0.22.0/tests/_device_tests/_tags_tests.py
|
||||
@@ -30,7 +30,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
|
||||
|
||||
Index: pyudev-0.22.0/tests/plugins/mock_libudev.py
|
||||
===================================================================
|
||||
--- pyudev-0.22.0.orig/tests/plugins/mock_libudev.py
|
||||
+++ pyudev-0.22.0/tests/plugins/mock_libudev.py
|
||||
@@ -33,7 +33,10 @@ from contextlib import contextmanager
|
||||
from collections import namedtuple
|
||||
|
||||
import pytest
|
||||
-import mock
|
||||
+try:
|
||||
+ from unittest import mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
|
||||
Node = namedtuple('Node', 'name value next')
|
||||
|
||||
Index: pyudev-0.22.0/tests/test_core.py
|
||||
===================================================================
|
||||
--- pyudev-0.22.0.orig/tests/test_core.py
|
||||
+++ pyudev-0.22.0/tests/test_core.py
|
||||
@@ -21,7 +21,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
|
||||
|
||||
Index: pyudev-0.22.0/tests/test_enumerate.py
|
||||
===================================================================
|
||||
--- pyudev-0.22.0.orig/tests/test_enumerate.py
|
||||
+++ pyudev-0.22.0/tests/test_enumerate.py
|
||||
@@ -18,7 +18,10 @@
|
||||
from __future__ import (print_function, division, unicode_literals,
|
||||
absolute_import)
|
||||
|
||||
-import mock
|
||||
+try:
|
||||
+ from unittest import mock
|
||||
+except ImportError:
|
||||
+ import mock
|
||||
import pytest
|
||||
|
||||
from hypothesis import given
|
||||
Index: pyudev-0.22.0/tests/test_monitor.py
|
||||
===================================================================
|
||||
--- pyudev-0.22.0.orig/tests/test_monitor.py
|
||||
+++ pyudev-0.22.0/tests/test_monitor.py
|
||||
@@ -24,7 +24,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
|
||||
|
||||
Index: pyudev-0.22.0/tests/test_observer.py
|
||||
===================================================================
|
||||
--- pyudev-0.22.0.orig/tests/test_observer.py
|
||||
+++ pyudev-0.22.0/tests/test_observer.py
|
||||
@@ -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
|
||||
|
||||
Index: pyudev-0.22.0/tests/test_observer_deprecated.py
|
||||
===================================================================
|
||||
--- pyudev-0.22.0.orig/tests/test_observer_deprecated.py
|
||||
+++ pyudev-0.22.0/tests/test_observer_deprecated.py
|
||||
@@ -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
|
||||
|
||||
Index: pyudev-0.22.0/requirements.txt
|
||||
===================================================================
|
||||
--- pyudev-0.22.0.orig/requirements.txt
|
||||
+++ pyudev-0.22.0/requirements.txt
|
||||
@@ -1,7 +1,7 @@
|
||||
# unit test requirements
|
||||
docutils>=0.9
|
||||
pytest>=2.8
|
||||
-mock>=1.0b1
|
||||
+mock>=1.0b1; python_version < "3.3"
|
||||
hypothesis==4.11.7
|
||||
|
||||
# documentation requirements
|
||||
Index: pyudev-0.22.0/tox.ini
|
||||
===================================================================
|
||||
--- pyudev-0.22.0.orig/tox.ini
|
||||
+++ pyudev-0.22.0/tox.ini
|
||||
@@ -6,7 +6,7 @@ setenv=LD_LIBRARY_PATH={envdir}/lib
|
||||
deps=
|
||||
docutils>=0.9
|
||||
pytest>=3.0
|
||||
- mock>=1.0b1
|
||||
+ mock>=1.0b1; python_version < "3.3"
|
||||
coverage
|
||||
hypothesis
|
||||
commands=
|
||||
@@ -18,7 +18,7 @@ commands=
|
||||
[testenv:doc]
|
||||
downloadcache={toxworkdir}/_download
|
||||
deps=
|
||||
- mock>=1.0b1
|
||||
+ mock>=1.0b1; python_version < "3.3"
|
||||
pytest>=2.8
|
||||
sphinx>=1.0.7
|
||||
commands=
|
||||
Index: pyudev-0.22.0/tests/test_util.py
|
||||
===================================================================
|
||||
--- pyudev-0.22.0.orig/tests/test_util.py
|
||||
+++ pyudev-0.22.0/tests/test_util.py
|
||||
@@ -21,7 +21,10 @@ from __future__ import (print_function,
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
-from mock import Mock
|
||||
+try:
|
||||
+ from unittest.mock import Mock
|
||||
+except ImportError:
|
||||
+ from mock import Mock
|
||||
|
||||
from hypothesis import given
|
||||
from hypothesis import settings
|
Loading…
Reference in New Issue
Block a user