summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick McLean <patrick.mclean@sony.com>2021-11-19 16:29:36 -0800
committerPatrick McLean <chutzpah@gentoo.org>2021-11-19 16:29:46 -0800
commitb151db9846ae3f0e7175748df4b75f91bd11cca8 (patch)
tree4ac1fcc553b4fbb4a8d6619a81ae1ad4dd540b3a /dev-python
parentmedia-libs/mesa: Version bump to 21.3.0 (diff)
downloadgentoo-b151db9846ae3f0e7175748df4b75f91bd11cca8.tar.gz
gentoo-b151db9846ae3f0e7175748df4b75f91bd11cca8.tar.bz2
gentoo-b151db9846ae3f0e7175748df4b75f91bd11cca8.zip
dev-python/pyudev: Restore 0.22-r1 with fixed patch
Closes: https://bugs.gentoo.org/824630 Copyright: Sony Interactive Entertainment Inc. Package-Manager: Portage-3.0.28, Repoman-3.0.3 Signed-off-by: Patrick McLean <chutzpah@gentoo.org>
Diffstat (limited to 'dev-python')
-rw-r--r--dev-python/pyudev/files/pyudev-0.22-fix-hypothesis.patch98
-rw-r--r--dev-python/pyudev/files/pyudev-0.22-remove-flaky-tests.patch126
-rw-r--r--dev-python/pyudev/pyudev-0.22.0-r1.ebuild51
3 files changed, 275 insertions, 0 deletions
diff --git a/dev-python/pyudev/files/pyudev-0.22-fix-hypothesis.patch b/dev-python/pyudev/files/pyudev-0.22-fix-hypothesis.patch
new file mode 100644
index 000000000000..5a6b27324d82
--- /dev/null
+++ b/dev-python/pyudev/files/pyudev-0.22-fix-hypothesis.patch
@@ -0,0 +1,98 @@
+diff --git a/tests/_device_tests/_attributes_tests.py b/tests/_device_tests/_attributes_tests.py
+index 23fa6da..7baf043 100644
+--- a/tests/_device_tests/_attributes_tests.py
++++ b/tests/_device_tests/_attributes_tests.py
+@@ -50,7 +50,7 @@ class TestAttributes(object):
+ """
+
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
+- @settings(max_examples=5)
++ @settings(max_examples=5, deadline=30000)
+ def test_getitem(self, a_context, device_datum):
+ """
+ Test that attribute value exists and is instance of bytes.
+@@ -60,7 +60,7 @@ def test_getitem(self, a_context, device_datum):
+ for key in device_datum.attributes.keys())
+
+ @given(strategies.sampled_from(_DEVICES))
+- @settings(max_examples=5)
++ @settings(max_examples=5, deadline=30000)
+ def test_getitem_nonexisting(self, a_device):
+ """
+ Test behavior when corresponding value is non-existant.
+@@ -87,7 +87,7 @@ def test_non_iterable(self, a_device):
+ a_device.attributes['key']
+
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
+- @settings(max_examples=5)
++ @settings(max_examples=5, deadline=30000)
+ def test_asstring(self, a_context, device_datum):
+ """
+ Test that attribute exists for actual device and is unicode.
+@@ -97,7 +97,7 @@ def test_asstring(self, a_context, device_datum):
+ for key in device_datum.attributes.keys())
+
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
+- @settings(max_examples=10)
++ @settings(max_examples=10, deadline=30000)
+ def test_asint(self, a_context, device_datum):
+ """
+ Test that integer result is an int or ValueError raised.
+@@ -111,7 +111,7 @@ def test_asint(self, a_context, device_datum):
+ device.attributes.asint(key)
+
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
+- @settings(max_examples=5)
++ @settings(max_examples=5, deadline=30000)
+ def test_asbool(self, a_context, device_datum):
+ """
+ Test that bool result is a bool or ValueError raised.
+diff --git a/tests/_device_tests/_device_tests.py b/tests/_device_tests/_device_tests.py
+index b9a84c6..2ce6751 100644
+--- a/tests/_device_tests/_device_tests.py
++++ b/tests/_device_tests/_device_tests.py
+@@ -352,7 +352,7 @@ def test_key_subset(self, a_context, device_datum):
+ frozenset(device.properties.keys())
+
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
+- @settings(max_examples=1)
++ @settings(max_examples=1, deadline=30000)
+ def test_getitem(self, a_context, device_datum):
+ device = Devices.from_path(a_context, device_datum.device_path)
+ for prop in device_datum.properties:
+@@ -372,7 +372,7 @@ def test_getitem(self, a_context, device_datum):
+ @pytest.mark.skipif(
+ len(_device_data) == 0, reason='no device with a DEVNAME property')
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_device_data))
+- @settings(max_examples=5)
++ @settings(max_examples=5, deadline=30000)
+ def test_getitem_devname(self, a_context, device_datum):
+ device = Devices.from_path(a_context, device_datum.device_path)
+ data_devname = os.path.join(a_context.device_path,
+@@ -382,7 +382,7 @@ def test_getitem_devname(self, a_context, device_datum):
+ assert device_devname == data_devname
+
+ @given(strategies.sampled_from(_DEVICES))
+- @settings(max_examples=5)
++ @settings(max_examples=5, deadline=30000)
+ def test_getitem_nonexisting(self, a_device):
+ with pytest.raises(KeyError) as excinfo:
+ # pylint: disable=pointless-statement
+@@ -390,7 +390,7 @@ def test_getitem_nonexisting(self, a_device):
+ assert str(excinfo.value) == repr('a non-existing property')
+
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
+- @settings(max_examples=5)
++ @settings(max_examples=5, deadline=30000)
+ def test_asint(self, a_context, device_datum):
+ device = Devices.from_path(a_context, device_datum.device_path)
+ for prop, value in device_datum.properties.items():
+@@ -403,7 +403,7 @@ def test_asint(self, a_context, device_datum):
+ assert device.properties.asint(prop) == value
+
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
+- @settings(max_examples=5)
++ @settings(max_examples=5, deadline=30000)
+ def test_asbool(self, a_context, device_datum):
+ """
+ Test that values of 1 and 0 get properly interpreted as bool
diff --git a/dev-python/pyudev/files/pyudev-0.22-remove-flaky-tests.patch b/dev-python/pyudev/files/pyudev-0.22-remove-flaky-tests.patch
new file mode 100644
index 000000000000..dd5b892606a3
--- /dev/null
+++ b/dev-python/pyudev/files/pyudev-0.22-remove-flaky-tests.patch
@@ -0,0 +1,126 @@
+commit a35c394f7f4eb714eeaab1b8ed7977f822e29fa9
+Author: mulhern <amulhern@redhat.com>
+Date: Wed May 2 15:50:45 2018 -0400
+
+ Get rid of all test_match_attribute_* methods
+
+ These tests are rendered flaky by the volatility of attribute values.
+
+ Signed-off-by: mulhern <amulhern@redhat.com>
+
+diff --git a/tests/test_enumerate.py b/tests/test_enumerate.py
+index f054799..c9c6a67 100644
+--- a/tests/test_enumerate.py
++++ b/tests/test_enumerate.py
+@@ -200,77 +200,6 @@ def test_match_property_bool(self, context, pair):
+ for device in devices
+ )
+
+- @failed_health_check_wrapper
+- @given(_CONTEXT_STRATEGY, _ATTRIBUTE_STRATEGY)
+- @settings(max_examples=50)
+- def test_match_attribute_nomatch_unfulfillable(self, context, pair):
+- """
+- Match and no match for a key/value gives empty set.
+- """
+- key, value = pair
+- devices = context.list_devices()
+- devices.match_attribute(key, value)
+- devices.match_attribute(key, value, nomatch=True)
+- assert not list(devices)
+-
+- @failed_health_check_wrapper
+- @given(_CONTEXT_STRATEGY, _ATTRIBUTE_STRATEGY)
+- @settings(max_examples=50)
+- def test_match_attribute_nomatch_complete(self, context, pair):
+- """
+- Test that w/ respect to the universe of devices returned by
+- list_devices() a match and its inverse are complements of each other.
+- """
+- key, value = pair
+- m_devices = frozenset(context.list_devices().match_attribute(
+- key, value))
+- nm_devices = frozenset(context.list_devices().match_attribute(
+- key, value, nomatch=True))
+- _test_intersection_and_union(context, m_devices, nm_devices)
+-
+- @failed_health_check_wrapper
+- @given(_CONTEXT_STRATEGY, _ATTRIBUTE_STRATEGY)
+- @settings(max_examples=50)
+- def test_match_attribute_string(self, context, pair):
+- """
+- Test that matching attribute as string works.
+- """
+- key, value = pair
+- devices = context.list_devices().match_attribute(key, value)
+- assert all(device.attributes.get(key) == value for device in devices)
+-
+- @failed_health_check_wrapper
+- @given(_CONTEXT_STRATEGY,
+- _ATTRIBUTE_STRATEGY.filter(lambda x: _is_int(x[1])))
+- @settings(max_examples=50)
+- def test_match_attribute_int(self, context, pair):
+- """
+- Test matching integer attribute.
+- """
+- key, value = pair
+- int_value = int(value)
+- devices = context.list_devices().match_attribute(key, int_value)
+- for device in devices:
+- attributes = device.attributes
+- assert attributes.get(key) == value
+- assert device.attributes.asint(key) == int_value
+-
+- @failed_health_check_wrapper
+- @given(_CONTEXT_STRATEGY,
+- _ATTRIBUTE_STRATEGY.filter(lambda x: _is_bool(x[1])))
+- @settings(max_examples=50)
+- def test_match_attribute_bool(self, context, pair):
+- """
+- Test matching boolean attribute.
+- """
+- key, value = pair
+- bool_value = True if int(value) == 1 else False
+- devices = context.list_devices().match_attribute(key, bool_value)
+- for device in devices:
+- attributes = device.attributes
+- assert attributes.get(key) == value
+- assert attributes.asbool(key) == bool_value
+-
+ @_UDEV_TEST(154, "test_match_tag")
+ @failed_health_check_wrapper
+ @given(_CONTEXT_STRATEGY, _TAG_STRATEGY)
+@@ -335,33 +264,6 @@ def test_combined_property_matches(self, context, ppairs):
+ )
+ )
+
+- @given(_CONTEXT_STRATEGY,
+- strategies.lists(
+- elements=_ATTRIBUTE_STRATEGY,
+- min_size=2,
+- max_size=3,
+- unique_by=lambda p: p[0]))
+- @settings(max_examples=20)
+- def test_combined_attribute_matches(self, context, apairs):
+- """
+- Test for conjunction of attributes.
+-
+- If matching multiple attributes, then the result is the intersection of
+- the matching sets, i.e., the resulting filter is a conjunction.
+- """
+- enumeration = context.list_devices()
+-
+- for key, value in apairs:
+- enumeration.match_attribute(key, value)
+-
+- _test_direct_and_complement(
+- context,
+- frozenset(enumeration),
+- lambda d: all(
+- d.attributes.get(key) == value for key, value in apairs
+- )
+- )
+-
+ @given(_CONTEXT_STRATEGY,
+ strategies.lists(
+ elements=_MATCH_PROPERTY_STRATEGY,
diff --git a/dev-python/pyudev/pyudev-0.22.0-r1.ebuild b/dev-python/pyudev/pyudev-0.22.0-r1.ebuild
new file mode 100644
index 000000000000..622a38c9c9c9
--- /dev/null
+++ b/dev-python/pyudev/pyudev-0.22.0-r1.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python3_{7..10} )
+
+inherit distutils-r1
+
+DESCRIPTION="Python binding to libudev"
+HOMEPAGE="https://pyudev.readthedocs.io/en/latest/ https://github.com/pyudev/pyudev"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="qt5"
+
+RDEPEND="
+ dev-python/six[${PYTHON_USEDEP}]
+ virtual/udev
+ qt5? ( dev-python/PyQt5[${PYTHON_USEDEP}] )
+"
+DEPEND="${RDEPEND}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ test? (
+ dev-python/docutils[${PYTHON_USEDEP}]
+ dev-python/hypothesis[${PYTHON_USEDEP}]
+ dev-python/mock[${PYTHON_USEDEP}]
+ )"
+
+DOCS=( CHANGES.rst README.rst )
+
+PATCHES=(
+ "${FILESDIR}/pyudev-0.22-fix-hypothesis.patch"
+)
+
+distutils_enable_tests pytest
+
+python_prepare_all() {
+ if use test; then
+ ewarn "If your PORTAGE_TMPDIR is longer in length then '/var/tmp/',"
+ ewarn "change it to /var/tmp to ensure tests will pass."
+ fi
+
+ # tests are known to pass then fail on alternate runs
+ # tests: fix run_path
+ sed -i -e "s|== \('/run/udev'\)|in (\1,'/dev/.udev')|g" \
+ tests/test_core.py || die
+
+ distutils-r1_python_prepare_all
+}