1
0
forked from pool/python-pyudev

- Update to version 0.22.0+git.1642212208.d5630bf:

* Remove another flakey test
  * Remove all traces of tox
  * Update next Fedora to 35
  * Delete a test which is probably flakey for real
  * Bump recommended development environment to fedora 34
  * Use yamllint on all the configuration files
  * Add annotations to GitHub workflows
  * No longer use --recursive for isort
  * Update formatting for new black
  * Establish a weekly task for future fedora
- Remove upstreamed patches:
  - remove_mock.patch

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyudev?expand=0&rev=45
This commit is contained in:
Matej Cepl 2022-01-17 06:03:59 +00:00 committed by Git OBS Bridge
parent 13c086aed2
commit 88151c10b0
10 changed files with 96 additions and 251 deletions

16
_service Normal file
View File

@ -0,0 +1,16 @@
<services>
<service name="obs_scm" mode="disabled">
<param name="versionprefix">0.22.0+git</param>
<param name="url">https://github.com/pyudev/pyudev.git</param>
<param name="scm">git</param>
<param name="exclude">.git*</param>
<param name="changesgenerate">enable</param>
<param name="changesauthor">mcepl@cepl.eu</param>
</service>
<service mode="disabled" name="tar" />
<service name="recompress" mode="disabled">
<param name="compression">xz</param>
<param name="file">*.tar</param>
</service>
<service name="set_version" mode="disabled"/>
</services>

4
_servicedata Normal file
View File

@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/pyudev/pyudev.git</param>
<param name="changesrevision">e358af68d743a63caa48a2dd1469ad265be39aa9</param></service></servicedata>

View File

@ -1,10 +1,10 @@
---
tests/test_enumerate.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
tests/test_enumerate.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/tests/test_enumerate.py
+++ b/tests/test_enumerate.py
@@ -90,7 +90,7 @@ class TestEnumerator(object):
@@ -91,7 +91,7 @@ class TestEnumerator(object):
@failed_health_check_wrapper
@given(_CONTEXT_STRATEGY, _SUBSYSTEM_STRATEGY)
@ -13,7 +13,7 @@
def test_match_subsystem(self, context, subsystem):
"""
Subsystem match matches devices w/ correct subsystem.
@@ -126,7 +126,7 @@ class TestEnumerator(object):
@@ -129,7 +129,7 @@ class TestEnumerator(object):
@failed_health_check_wrapper
@given(_CONTEXT_STRATEGY, _SUBSYSTEM_STRATEGY)
@ -22,3 +22,12 @@
def test_match_subsystem_nomatch_complete(self, context, subsystem):
"""
Test that w/ respect to the universe of devices returned by
@@ -221,7 +221,7 @@ class TestEnumeratorMatchCombinations(ob
unique_by=lambda p: p[0],
),
)
- @settings(max_examples=2)
+ @settings(max_examples=2, deadline=500)
def test_combined_property_matches(self, context, ppairs):
"""
Test for behaviour as observed in #1

View File

@ -3,9 +3,9 @@
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_enumerate.py | 2 +-
tests/test_util.py | 2 ++
6 files changed, 16 insertions(+), 4 deletions(-)
6 files changed, 12 insertions(+), 2 deletions(-)
--- a/pytest.ini
+++ b/pytest.ini
@ -19,7 +19,7 @@
+ real_udev
--- a/tests/_device_tests/_attributes_tests.py
+++ b/tests/_device_tests/_attributes_tests.py
@@ -124,6 +124,7 @@ class TestAttributes(object):
@@ -122,6 +122,7 @@ class TestAttributes(object):
with pytest.raises(ValueError):
device.attributes.asbool(key)
@ -27,61 +27,45 @@
@_UDEV_TEST(167, "test_available_attributes")
@given(strategies.sampled_from(_DEVICES))
@settings(max_examples=5)
--- a/tests/_device_tests/_device_tests.py
+++ b/tests/_device_tests/_device_tests.py
@@ -215,6 +215,7 @@ class TestDevice(object):
if device.device_node:
assert is_unicode_string(device.device_node)
+ @pytest.mark.real_udev
@given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
@settings(max_examples=5)
def test_device_number(self, a_context, device_datum):
--- 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'
@@ -128,6 +128,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)
@@ -143,6 +144,7 @@ class TestDevices(object):
device = 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):
@@ -178,6 +180,7 @@ class TestDevices(object):
with pytest.raises(DeviceNotFoundByNumberError):
Devices.from_device_number(_CONTEXT, 'foobar', 100)
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):
@@ -104,7 +104,7 @@ class TestEnumerator(object):
@failed_health_check_wrapper
@given(_CONTEXT_STRATEGY, _SUBSYSTEM_STRATEGY)
@ -90,29 +74,21 @@
def test_match_subsystem_nomatch(self, context, subsystem):
"""
Subsystem no match gets no subsystem with subsystem.
@@ -151,7 +152,7 @@ class TestEnumerator(object):
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -132,6 +132,7 @@ def raise_valueerror():
_CHAR_DEVICES = list(_CONTEXT.list_devices(subsystem="tty"))
@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
+@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)
@@ -145,6 +146,7 @@ def test_get_device_type_character_devic
_BLOCK_DEVICES = list(_CONTEXT.list_devices(subsystem="block"))
@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.
+@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)

View File

@ -1,3 +1,20 @@
-------------------------------------------------------------------
Sun Jan 16 22:53:34 UTC 2022 - mcepl@cepl.eu
- Update to version 0.22.0+git.1642212208.d5630bf:
* Remove another flakey test
* Remove all traces of tox
* Update next Fedora to 35
* Delete a test which is probably flakey for real
* Bump recommended development environment to fedora 34
* Use yamllint on all the configuration files
* Add annotations to GitHub workflows
* No longer use --recursive for isort
* Update formatting for new black
* Establish a weekly task for future fedora
- Remove upstreamed patches:
- remove_mock.patch
-------------------------------------------------------------------
Tue Aug 10 12:49:04 UTC 2021 - Matej Cepl <mcepl@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package python-pyudev
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -18,18 +18,16 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-pyudev
Version: 0.22.0
Version: 0.22.0+git.1642212208.d5630bf
Release: 0
Summary: Udev bindings for Python
License: LGPL-2.1-or-later
Group: Development/Libraries/Python
URL: http://pyudev.readthedocs.org/
Source0: https://files.pythonhosted.org/packages/source/p/pyudev/pyudev-%{version}.tar.gz
Source0: pyudev-%{version}.tar.xz
# 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
# PATCH-FIX-OPENSUSE hypothesis_settings.patch mcepl@suse.com
# tests timeout on OBS
Patch2: hypothesis_settings.patch

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:aadd5ef8d671bc6885f368361d0895bdcb4964a75fcd8cd8b37ddb4a08db137c
size 67520

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:69bb1beb7ac52855b6d1b9fe909eefb0017f38d917cba9939602c6880035b276
size 85077

4
pyudev.obsinfo Normal file
View File

@ -0,0 +1,4 @@
name: pyudev
version: 0.22.0+git.1642212208.d5630bf
mtime: 1642212208
commit: d5630bf15692b652db55d626f66274169f3448d5

View File

@ -1,179 +0,0 @@
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