summaryrefslogtreecommitdiff
path: root/dev-python/pyudev
diff options
context:
space:
mode:
authorLiguros - Gitlab CI/CD [develop] <gitlab@liguros.net>2021-11-20 13:45:30 +0000
committerLiguros - Gitlab CI/CD [develop] <gitlab@liguros.net>2021-11-20 13:45:30 +0000
commitec1c225e35a1d628dd5ada55d7faf6b9d6f17741 (patch)
tree787fdd663a767acd7c09759033c14f99f18e5b7e /dev-python/pyudev
parent16792718a745ca7166ea9c37ec61b56347ab4e1a (diff)
downloadbaldeagleos-repo-ec1c225e35a1d628dd5ada55d7faf6b9d6f17741.tar.gz
baldeagleos-repo-ec1c225e35a1d628dd5ada55d7faf6b9d6f17741.tar.xz
baldeagleos-repo-ec1c225e35a1d628dd5ada55d7faf6b9d6f17741.zip
Adding metadata
Diffstat (limited to 'dev-python/pyudev')
-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..01d11c296513
--- /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_{6,7,8,9,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
+}