forked from pool/python-pyudev
Accepting request 840460 from devel:languages:python
- Add pytest_register_mark.patch to make the test suite at least syntactically correct and skip over tests we cannot run because of missing /dev gh#pyudev/pyudev#404. OBS-URL: https://build.opensuse.org/request/show/840460 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pyudev?expand=0&rev=22
This commit is contained in:
commit
262d274b4b
118
pytest_register_mark.patch
Normal file
118
pytest_register_mark.patch
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
---
|
||||||
|
pytest.ini | 5 ++++-
|
||||||
|
tests/_device_tests/_attributes_tests.py | 1 +
|
||||||
|
tests/_device_tests/_device_tests.py | 1 +
|
||||||
|
tests/_device_tests/_devices_tests.py | 3 +++
|
||||||
|
tests/test_enumerate.py | 8 +++++---
|
||||||
|
tests/test_util.py | 2 ++
|
||||||
|
6 files changed, 16 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
--- a/pytest.ini
|
||||||
|
+++ b/pytest.ini
|
||||||
|
@@ -1,3 +1,6 @@
|
||||||
|
-[tool:pytest]
|
||||||
|
+[pytest]
|
||||||
|
# do not search for tests in build directory
|
||||||
|
norecursedirs = .* _* build
|
||||||
|
+markers =
|
||||||
|
+ conversion
|
||||||
|
+ real_udev
|
||||||
|
--- a/tests/_device_tests/_attributes_tests.py
|
||||||
|
+++ b/tests/_device_tests/_attributes_tests.py
|
||||||
|
@@ -124,6 +124,7 @@ class TestAttributes(object):
|
||||||
|
with pytest.raises(ValueError):
|
||||||
|
device.attributes.asbool(key)
|
||||||
|
|
||||||
|
+ @pytest.mark.real_udev
|
||||||
|
@_UDEV_TEST(167, "test_available_attributes")
|
||||||
|
@given(strategies.sampled_from(_DEVICES))
|
||||||
|
@settings(max_examples=5)
|
||||||
|
--- a/tests/_device_tests/_devices_tests.py
|
||||||
|
+++ b/tests/_device_tests/_devices_tests.py
|
||||||
|
@@ -127,6 +127,7 @@ class TestDevices(object):
|
||||||
|
assert error.subsystem == 'no_such_subsystem'
|
||||||
|
assert error.sys_name == 'foobar'
|
||||||
|
|
||||||
|
+ @pytest.mark.real_udev
|
||||||
|
@failed_health_check_wrapper
|
||||||
|
@given(
|
||||||
|
_CONTEXT_STRATEGY,
|
||||||
|
@@ -142,6 +143,7 @@ class TestDevices(object):
|
||||||
|
Devices.from_device_number(a_context, typ, a_device.device_number)
|
||||||
|
assert a_device == device
|
||||||
|
|
||||||
|
+ @pytest.mark.real_udev
|
||||||
|
@failed_health_check_wrapper
|
||||||
|
@given(
|
||||||
|
_CONTEXT_STRATEGY,
|
||||||
|
@@ -177,6 +179,7 @@ class TestDevices(object):
|
||||||
|
with pytest.raises(DeviceNotFoundByNumberError):
|
||||||
|
Devices.from_device_number(_CONTEXT, 'foobar', 100)
|
||||||
|
|
||||||
|
+ @pytest.mark.real_udev
|
||||||
|
@failed_health_check_wrapper
|
||||||
|
@given(
|
||||||
|
_CONTEXT_STRATEGY,
|
||||||
|
--- a/tests/test_util.py
|
||||||
|
+++ b/tests/test_util.py
|
||||||
|
@@ -124,6 +124,7 @@ def raise_valueerror():
|
||||||
|
_CHAR_DEVICES = list(_CONTEXT.list_devices(subsystem="tty"))
|
||||||
|
|
||||||
|
|
||||||
|
+@pytest.mark.real_udev
|
||||||
|
@pytest.mark.skipif(len(_CHAR_DEVICES) == 0, reason='no tty devices')
|
||||||
|
@given(strategies.sampled_from(_CHAR_DEVICES))
|
||||||
|
@settings(max_examples=5)
|
||||||
|
@@ -137,6 +138,7 @@ def test_get_device_type_character_devic
|
||||||
|
_BLOCK_DEVICES = list(_CONTEXT.list_devices(subsystem="block"))
|
||||||
|
|
||||||
|
|
||||||
|
+@pytest.mark.real_udev
|
||||||
|
@pytest.mark.skipif(len(_BLOCK_DEVICES) == 0, reason='no block devices')
|
||||||
|
@given(strategies.sampled_from(_BLOCK_DEVICES))
|
||||||
|
@settings(max_examples=5)
|
||||||
|
--- a/tests/test_enumerate.py
|
||||||
|
+++ b/tests/test_enumerate.py
|
||||||
|
@@ -19,6 +19,7 @@ from __future__ import (print_function,
|
||||||
|
absolute_import)
|
||||||
|
|
||||||
|
import mock
|
||||||
|
+import pytest
|
||||||
|
|
||||||
|
from hypothesis import given
|
||||||
|
from hypothesis import settings
|
||||||
|
@@ -98,7 +99,7 @@ class TestEnumerator(object):
|
||||||
|
|
||||||
|
@failed_health_check_wrapper
|
||||||
|
@given(_CONTEXT_STRATEGY, _SUBSYSTEM_STRATEGY)
|
||||||
|
- @settings(max_examples=1)
|
||||||
|
+ @settings(max_examples=1, deadline=None)
|
||||||
|
def test_match_subsystem_nomatch(self, context, subsystem):
|
||||||
|
"""
|
||||||
|
Subsystem no match gets no subsystem with subsystem.
|
||||||
|
@@ -151,7 +152,7 @@ class TestEnumerator(object):
|
||||||
|
|
||||||
|
@failed_health_check_wrapper
|
||||||
|
@given(_CONTEXT_STRATEGY, _MATCH_PROPERTY_STRATEGY)
|
||||||
|
- @settings(max_examples=25)
|
||||||
|
+ @settings(max_examples=25, deadline=None)
|
||||||
|
def test_match_property_string(self, context, pair):
|
||||||
|
"""
|
||||||
|
Match property only gets devices with that property.
|
||||||
|
@@ -233,6 +234,7 @@ class TestEnumeratorMatchCombinations(ob
|
||||||
|
Test combinations of matches.
|
||||||
|
"""
|
||||||
|
|
||||||
|
+ @pytest.mark.real_udev
|
||||||
|
@given(_CONTEXT_STRATEGY,
|
||||||
|
strategies.lists(
|
||||||
|
elements=_MATCH_PROPERTY_STRATEGY,
|
||||||
|
@@ -262,7 +264,7 @@ class TestEnumeratorMatchCombinations(ob
|
||||||
|
|
||||||
|
@given(_CONTEXT_STRATEGY, _SUBSYSTEM_STRATEGY, _SYSNAME_STRATEGY,
|
||||||
|
_MATCH_PROPERTY_STRATEGY)
|
||||||
|
- @settings(max_examples=10)
|
||||||
|
+ @settings(max_examples=10, deadline=None)
|
||||||
|
def test_match(self, context, subsystem, sysname, ppair):
|
||||||
|
"""
|
||||||
|
Test that matches from different categories are a conjunction.
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Oct 8 23:03:04 UTC 2020 - Matej Cepl <mcepl@suse.com>
|
||||||
|
|
||||||
|
- Add pytest_register_mark.patch to make the test suite at least
|
||||||
|
syntactically correct and skip over tests we cannot run because
|
||||||
|
of missing /dev gh#pyudev/pyudev#404.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Feb 28 21:38:51 UTC 2020 - Dirk Mueller <dmueller@suse.com>
|
Fri Feb 28 21:38:51 UTC 2020 - Dirk Mueller <dmueller@suse.com>
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
|
|
||||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||||
%bcond_with test
|
|
||||||
Name: python-pyudev
|
Name: python-pyudev
|
||||||
Version: 0.22.0
|
Version: 0.22.0
|
||||||
Release: 0
|
Release: 0
|
||||||
@ -26,22 +25,27 @@ License: LGPL-2.1-or-later
|
|||||||
Group: Development/Libraries/Python
|
Group: Development/Libraries/Python
|
||||||
URL: http://pyudev.readthedocs.org/
|
URL: http://pyudev.readthedocs.org/
|
||||||
Source0: https://files.pythonhosted.org/packages/source/p/pyudev/pyudev-%{version}.tar.gz
|
Source0: https://files.pythonhosted.org/packages/source/p/pyudev/pyudev-%{version}.tar.gz
|
||||||
|
# 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
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: %{python_module six}
|
BuildRequires: %{python_module six}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: pkgconfig
|
BuildRequires: pkgconfig
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
BuildRequires: pkgconfig(libudev)
|
BuildRequires: pkgconfig(libudev)
|
||||||
|
BuildRequires: pkgconfig(udev)
|
||||||
Requires: libudev1
|
Requires: libudev1
|
||||||
Requires: python-six
|
Requires: python-six
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%if %{with test}
|
BuildRequires: %{python_module Sphinx}
|
||||||
BuildRequires: %{python_module docutils}
|
BuildRequires: %{python_module docutils}
|
||||||
BuildRequires: %{python_module hypothesis}
|
BuildRequires: %{python_module hypothesis}
|
||||||
BuildRequires: %{python_module mock}
|
BuildRequires: %{python_module mock}
|
||||||
|
BuildRequires: %{python_module pylint}
|
||||||
BuildRequires: %{python_module pytest}
|
BuildRequires: %{python_module pytest}
|
||||||
BuildRequires: %{python_module six}
|
BuildRequires: %{python_module six}
|
||||||
%endif
|
BuildRequires: %{python_module yapf}
|
||||||
%ifpython2
|
%ifpython2
|
||||||
# pyudev was last used in KDE:Unstable:Playground (pyudev-0.8)
|
# pyudev was last used in KDE:Unstable:Playground (pyudev-0.8)
|
||||||
Provides: pyudev = %{version}
|
Provides: pyudev = %{version}
|
||||||
@ -54,7 +58,8 @@ A Python binding to libudev, the hardware management library and service found
|
|||||||
in modern linux systems.
|
in modern linux systems.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n pyudev-%{version}
|
%autosetup -p1 -n pyudev-%{version}
|
||||||
|
|
||||||
# Disable intersphinx and issuetracker, we don't want to access the web during doc build:
|
# Disable intersphinx and issuetracker, we don't want to access the web during doc build:
|
||||||
sed -i -e "s|'sphinx.ext.intersphinx',\\?||" -e "s|'sphinxcontrib.issuetracker',\\?||" doc/conf.py
|
sed -i -e "s|'sphinx.ext.intersphinx',\\?||" -e "s|'sphinxcontrib.issuetracker',\\?||" doc/conf.py
|
||||||
|
|
||||||
@ -65,10 +70,9 @@ sed -i -e "s|'sphinx.ext.intersphinx',\\?||" -e "s|'sphinxcontrib.issuetracker',
|
|||||||
%python_install
|
%python_install
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
|
||||||
%if %{with test}
|
|
||||||
%check
|
%check
|
||||||
%python_expand nosetests-%{$python_bin_suffix}
|
# We don't have real /dev in osc build chroot gh#pyudev/pyudev#404
|
||||||
%endif
|
%pytest -k 'not real_udev'
|
||||||
|
|
||||||
%files %{python_files}
|
%files %{python_files}
|
||||||
%license COPYING
|
%license COPYING
|
||||||
|
Loading…
Reference in New Issue
Block a user