diff --git a/backport-Drop-a-flaky-test.patch b/backport-Drop-a-flaky-test.patch new file mode 100644 index 0000000..d18d498 --- /dev/null +++ b/backport-Drop-a-flaky-test.patch @@ -0,0 +1,45 @@ +From f9c10f84cb60abb87d2240c15fee8c82e643fbf8 Mon Sep 17 00:00:00 2001 +From: mulhern +Date: Wed, 21 Dec 2022 19:20:22 -0500 +Subject: [PATCH] Drop a flaky test + +Signed-off-by: mulhern +--- + tests/_device_tests/_attributes_tests.py | 24 ------------------------ + 1 file changed, 24 deletions(-) + +diff --git a/tests/_device_tests/_attributes_tests.py b/tests/_device_tests/_attributes_tests.py +index 23fa6da..ef54f80 100644 +--- a/tests/_device_tests/_attributes_tests.py ++++ b/tests/_device_tests/_attributes_tests.py +@@ -123,27 +123,3 @@ class TestAttributes(object): + else: + with pytest.raises(ValueError): + device.attributes.asbool(key) +- +- @_UDEV_TEST(167, "test_available_attributes") +- @given(strategies.sampled_from(_DEVICES)) +- @settings(max_examples=5) +- def test_available_attributes(self, a_device): +- """ +- Test that the available attributes are exactly the names of files +- in the sysfs directory that are regular files or softlinks. +- """ +- available_attributes = sorted(a_device.attributes.available_attributes) +- +- attribute_filenames = [] +- sys_path = a_device.sys_path +- for filename in sorted(os.listdir(sys_path)): +- filepath = os.path.join(sys_path, filename) +- status = os.lstat(filepath) +- mode = status.st_mode +- if not stat.S_ISLNK(mode) and not stat.S_ISREG(mode): +- continue +- if not stat.S_IRUSR & mode: +- continue +- attribute_filenames.append(filename) +- +- assert available_attributes == attribute_filenames +-- +2.27.0 + diff --git a/python-pyudev.spec b/python-pyudev.spec index 6041a76..a9411ed 100644 --- a/python-pyudev.spec +++ b/python-pyudev.spec @@ -1,13 +1,15 @@ %global srcname pyudev Name: python-%{srcname} Version: 0.22.0 -Release: 1 +Release: 2 Summary: A libudev binding License: LGPLv2+ URL: http://pypi.python.org/pypi/pyudev Source0: https://pypi.io/packages/source/p/%{srcname}/%{srcname}-%{version}.tar.gz BuildArch: noarch +Patch6000: backport-Drop-a-flaky-test.patch + %global _description\ This package supports almost all libudev functionality.The lisence\ is LGPL.It is a python 2/3 binding to libudev which is a linux\ @@ -19,6 +21,7 @@ and you can use it after a quick learning. %package -n python2-%{srcname} Summary: %summary BuildRequires: python2-devel python2-setuptools +BuildRequires: python2-pytest python2-pyudev python2-mock python2-hypothesis python2-docutils Requires: glibc systemd python2-six Provides: python2-%{srcname}-glib python2-%{srcname}-qt4 python2-%{srcname}-qt5 python2-%{srcname}-pyside python2-%{srcname}-wx Obsoletes: python2-%{srcname}-glib python2-%{srcname}-qt4 python2-%{srcname}-qt5 python2-%{srcname}-pyside python2-%{srcname}-wx @@ -28,6 +31,7 @@ Obsoletes: python2-%{srcname}-glib python2-%{srcname}-qt4 python2-%{srcname}-qt5 %package -n python3-%{srcname} Summary: A libudev binding BuildRequires: python3-devel python3-setuptools +BuildRequires: python3-pytest python3-pyudev python3-mock python3-hypothesis python3-docutils Requires: systemd python3-six Provides: python3-%{srcname}-qt4 python3-%{srcname}-qt5 Obsoletes: python3-%{srcname}-qt4 python3-%{srcname}-qt5 @@ -35,7 +39,7 @@ Obsoletes: python3-%{srcname}-qt4 python3-%{srcname}-qt5 %{?python_provide:%python_provide python3-%{srcname}} %prep -%autosetup -n %{srcname}-%{version} +%autosetup -n %{srcname}-%{version} -p1 rm -rf pyudev.egg-info %build @@ -46,6 +50,10 @@ rm -rf pyudev.egg-info %py2_install %py3_install +%check +pytest-2 -v --ignore=./tests/test_device.py --ignore=./tests/test_core.py --ignore=./tests/test_enumerate.py --ignore=./tests/test_monitor.py -k 'not (test_get_device_type_character_device or test_get_device_type_block_device or test_fake_monitor)' +pytest-3 -v --ignore=./tests/test_device.py --ignore=./tests/test_core.py --ignore=./tests/test_enumerate.py --ignore=./tests/test_monitor.py -k 'not (test_get_device_type_character_device or test_get_device_type_block_device or test_fake_monitor)' + %files -n python2-%{srcname} %license COPYING %doc README.rst CHANGES.rst @@ -66,6 +74,9 @@ rm -rf pyudev.egg-info %changelog +* Wed Jun 07 2023 renhongxun - 0.22.0-2 +- enable check + * Thu Aug 20 2020 SimpleUpdate Robot - 0.22.0-1 - Upgrade to version 0.22.0