* [gentoo-commits] repo/gentoo:master commit in: dev-python/pyudev/, dev-python/pyudev/files/
@ 2016-04-08 2:06 Patrick McLean
0 siblings, 0 replies; 7+ messages in thread
From: Patrick McLean @ 2016-04-08 2:06 UTC (permalink / raw
To: gentoo-commits
commit: cce2bc0a8316c761a93effffb587065a325e9ed2
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Fri Apr 8 02:06:28 2016 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Fri Apr 8 02:06:28 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cce2bc0a
dev-python/pyudev: Version bump
Package-Manager: portage-2.2.28
dev-python/pyudev/Manifest | 1 +
.../pyudev-0.19.0-Fixes-for-ID_PATH-parsing.patch | 213 +++++++++++++++++++++
...pyudev-0.19.0-skip-non-deterministic-test.patch | 78 ++++++++
dev-python/pyudev/pyudev-0.19.0.ebuild | 63 ++++++
4 files changed, 355 insertions(+)
diff --git a/dev-python/pyudev/Manifest b/dev-python/pyudev/Manifest
index dcada97..25e94a8 100644
--- a/dev-python/pyudev/Manifest
+++ b/dev-python/pyudev/Manifest
@@ -1 +1,2 @@
DIST pyudev-0.16.1.tar.gz 74953 SHA256 765d1c14bd9bd031f64e2612225621984cb2bbb8cbc0c03538bcc4c735ff1c95 SHA512 7f62c6794027411583f874bdf746de457f19048955867d30008bc1ee0d30040a97f73b9e52ae3645d469fc401128703d4e703e294b85481e927ffaba27e45e6a WHIRLPOOL 4c366a1eed92bf274ef84eab6242beb09cd6e906556f6ccb24113fafec2dcc47b8da94487505473fc6f7b39539cdc2809cef2d07a1ab8c0616fc73efba9b2e1a
+DIST pyudev-0.19.0.tar.gz 96556 SHA256 5abcbd03e4965110d1fedcbdd5532974cb4638ceef34337aa2d5758eceb54ad3 SHA512 7faee69e8e3512e27b0d9271191d4b2906652b2c7f3a803be026a10499d184c1fc41db80624dec9f33ee890d71a695214c6bfd47f6cc41b979f71f619836f3f8 WHIRLPOOL 6b496f0f977b97247a13ba4f9f8efe24624d932c6cfc7616922473d8839a90500f60d3b238bbab4a9c9cdd6c5997606ee41de63669e3b2fa868d1b6f28ae492b
diff --git a/dev-python/pyudev/files/pyudev-0.19.0-Fixes-for-ID_PATH-parsing.patch b/dev-python/pyudev/files/pyudev-0.19.0-Fixes-for-ID_PATH-parsing.patch
new file mode 100644
index 0000000..6a9bf65
--- /dev/null
+++ b/dev-python/pyudev/files/pyudev-0.19.0-Fixes-for-ID_PATH-parsing.patch
@@ -0,0 +1,213 @@
+commit b1cc8624a2ad8afdc04181ccf6ca42c37a9a701e
+Author: mulhern <amulhern@redhat.com>
+Date: Mon Feb 15 14:13:49 2016 -0500
+
+ Fixes for ID_PATH parsing.
+
+ * Disable individual fields matching '-'.
+ * Do not try to parse delimiter '-' between distinct ids.
+ * Change format for a sas path.
+ * Handle virtio-pci.
+
+ Signed-off-by: mulhern <amulhern@redhat.com>
+
+diff --git a/src/pyudev/_parsing/_id_path.py b/src/pyudev/_parsing/_id_path.py
+index c94f332..0b65c43 100644
+--- a/src/pyudev/_parsing/_id_path.py
++++ b/src/pyudev/_parsing/_id_path.py
+@@ -35,6 +35,16 @@
+ from ._shared import Parser
+
+
++class IdPathField(Field):
++ """
++ Overrides default regular expression.
++ """
++ # pylint: disable=too-few-public-methods
++
++ def __init__(self, name, regexp=r'[^-]+', description=None):
++ super(IdPathField, self).__init__(name, regexp, description)
++
++
+ class IdPathParsers(object):
+ """
+ Aggregate parsers.
+@@ -42,70 +52,73 @@ class IdPathParsers(object):
+ # pylint: disable=too-few-public-methods
+
+ PARSERS = [
+- Parser(r'acpi-%s', [Field('sys_name')]),
+- Parser(r'ap-%s', [Field('sys_name')]),
+- Parser(r'ata-%s', [Field('port_no')]),
+- Parser(r'bcma-%s', [Field('core')]),
+- Parser(r'cciss-disk%s', [Field('disk')]),
+- Parser(r'ccw-%s', [Field('sys_name')]),
+- Parser(r'ccwgroup-%s', [Field('sys_name')]),
+- Parser(r'fc-%s-%s', [Field('port_name'), Field('lun')]),
++ Parser(r'acpi-%s', [IdPathField('sys_name')]),
++ Parser(r'ap-%s', [IdPathField('sys_name')]),
++ Parser(r'ata-%s', [IdPathField('port_no')]),
++ Parser(r'bcma-%s', [IdPathField('core')]),
++ Parser(r'cciss-disk%s', [IdPathField('disk')]),
++ Parser(r'ccw-%s', [IdPathField('sys_name')]),
++ Parser(r'ccwgroup-%s', [IdPathField('sys_name')]),
++ Parser(r'fc-%s-%s', [IdPathField('port_name'), IdPathField('lun')]),
+ Parser(
+ r'ip-%s:%s-iscsi-%s-%s',
+ [
+- Field('persistent_address'),
+- Field('persistent_port'),
+- Field('target_name'),
+- Field('lun')
++ IdPathField('persistent_address'),
++ IdPathField('persistent_port'),
++ IdPathField('target_name'),
++ IdPathField('lun')
+ ]
+ ),
+- Parser(r'iucv-%s', [Field('sys_name')]),
+- Parser(r'nst%s', [Field('name')]),
+- Parser(r'pci-%s', [Field('sys_name')]),
+- Parser(r'platform-%s', [Field('sys_name')]),
+- Parser(r'sas-%s-%s', [Field('sas_address'), Field('lun')]),
++ Parser(r'iucv-%s', [IdPathField('sys_name')]),
++ Parser(r'nst%s', [IdPathField('name')]),
++ Parser(r'pci-%s', [IdPathField('sys_name')]),
++ Parser(r'platform-%s', [IdPathField('sys_name')]),
++ Parser(r'sas-%s-lun-%s',
++ [IdPathField('sas_address'), IdPathField('lun')]
++ ),
+ Parser(
+ r'sas-exp%s-phy%s-%s',
+ [
+- Field(
++ IdPathField(
+ 'sas_address',
+ r'.*',
+ 'sysfs sas_address attribute of expander'
+ ),
+- Field(
++ IdPathField(
+ 'phy_identifier',
+ r'.*',
+ 'sysfs phy_identifier attribute of target sas device'
+ ),
+- Field('lun', description='sysnum of device (0 if none)')
++ IdPathField('lun', description='sysnum of device (0 if none)')
+ ]
+ ),
+ Parser(
+ r'sas-phy%s-%s',
+ [
+- Field(
++ IdPathField(
+ 'phy_identifier',
+ r'.*',
+ 'sysfs phy_identifier attribute of target sas device'
+ ),
+- Field('lun', description='sysnum of device (0 if none)')
++ IdPathField('lun', description='sysnum of device (0 if none)')
+ ]
+ ),
+- Parser(r'scm-%s', [Field('sys_name')]),
++ Parser(r'scm-%s', [IdPathField('sys_name')]),
+ Parser(
+ r'scsi-%s:%s:%s:%s',
+ [
+- Field('host'),
+- Field('bus'),
+- Field('target'),
+- Field('lun')
++ IdPathField('host'),
++ IdPathField('bus'),
++ IdPathField('target'),
++ IdPathField('lun')
+ ]
+ ),
+- Parser('serio-%s', [Field('sysnum')]),
+- Parser('st%s', [Field('name')]),
+- Parser('usb-0:%s', [Field('port')]),
+- Parser('vmbus-%s-%s', [Field('guid'), Field('lun')]),
+- Parser('xen-%s', [Field('sys_name')])
++ Parser('serio-%s', [IdPathField('sysnum')]),
++ Parser('st%s', [IdPathField('name')]),
++ Parser('usb-0:%s', [IdPathField('port')]),
++ Parser('virtio-pci-%s', [IdPathField('sys_name')]),
++ Parser('vmbus-%s-%s', [IdPathField('guid'), IdPathField('lun')]),
++ Parser('xen-%s', [IdPathField('sys_name')])
+ ]
+
+
+@@ -166,6 +179,6 @@ def parse(self, value):
+
+ (parser, best_match) = max(matches, key=lambda x: len(x[0].prefix))
+ match_list.append((parser, best_match))
+- value = value[len(best_match.group('total')):]
++ value = value[len(best_match.group('total')) + 1:]
+
+ return match_list
+diff --git a/tests/test_parsing.py b/tests/test_parsing.py
+index 619fb01..fba5575 100644
+--- a/tests/test_parsing.py
++++ b/tests/test_parsing.py
+@@ -52,20 +52,27 @@ class TestIDPATH(object):
+ Test parsing ID_PATH values.
+ """
+ # pylint: disable=too-few-public-methods
+-
+- @given(
+- strategies.sampled_from(_DEVICES).filter(
+- lambda x: x.get('ID_PATH') is not None
+- )
++ _devices = [d for d in _DEVICES if d.get('ID_PATH') is not None]
++ @pytest.mark.skipif(
++ len(_devices) == 0,
++ reason="no devices with ID_PATH property"
+ )
++ @given(strategies.sampled_from(_devices))
++ @settings(min_satisfying_examples=1)
+ def test_parsing(self, a_device):
+ """
+ Test that parsing is satisfactory on all examples.
+ """
++ parsers = _parsing.IdPathParsers.PARSERS
+ id_path = a_device.get('ID_PATH')
+- parser = _parsing.IdPathParse(_parsing.IdPathParsers.PARSERS)
++ parser = _parsing.IdPathParse(parsers)
+ result = parser.parse(id_path)
+ assert isinstance(result, list) and result != []
++ assert all(
++ any(r[1].group('total').startswith(p.prefix) for p in parsers) \
++ for r in result
++ )
++ assert not any(r[1].group('total').startswith('-') for r in result)
+
+ _devices = [d for d in _DEVICES if d.get('ID_SAS_PATH') is not None]
+ @pytest.mark.skipif(
+@@ -78,10 +85,25 @@ def test_parsing_sas_path(self, a_device):
+ """
+ Test that parsing is satisfactory on all examples.
+ """
++ parsers = _parsing.IdPathParsers.PARSERS
+ id_path = a_device.get('ID_SAS_PATH')
+- parser = _parsing.IdPathParse(_parsing.IdPathParsers.PARSERS)
++ parser = _parsing.IdPathParse(parsers)
+ result = parser.parse(id_path)
+ assert isinstance(result, list) and result != []
++ assert all(
++ any(r[1].group('total').startswith(p.prefix) for p in parsers) \
++ for r in result
++ )
++ assert not any(r[1].group('total').startswith('-') for r in result)
++
++ def test_failure(self):
++ """
++ Test at least one failure.
++ """
++ id_path = 'pci-0000_09_00_0-sas0x5000155359566200-lun-0'
++ parser = _parsing.IdPathParse(_parsing.IdPathParsers.PARSERS)
++ result = parser.parse(id_path)
++ assert result == []
+
+
+ class TestDevlinks(object):
diff --git a/dev-python/pyudev/files/pyudev-0.19.0-skip-non-deterministic-test.patch b/dev-python/pyudev/files/pyudev-0.19.0-skip-non-deterministic-test.patch
new file mode 100644
index 0000000..268d2bd
--- /dev/null
+++ b/dev-python/pyudev/files/pyudev-0.19.0-skip-non-deterministic-test.patch
@@ -0,0 +1,78 @@
+diff --git a/tests/_device_tests/_attributes_tests.py b/tests/_device_tests/_attributes_tests.py
+index 54d8ae6..84e26c3 100644
+--- a/tests/_device_tests/_attributes_tests.py
++++ b/tests/_device_tests/_attributes_tests.py
+@@ -88,6 +88,7 @@ def test_non_iterable(self, a_device):
+ with pytest.raises(TypeError):
+ a_device.attributes['key']
+
++ @pytest.mark.skipif(True, reason='Non-deterministic')
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
+ @settings(max_examples=5)
+ def test_asstring(self, a_context, device_datum):
+@@ -99,6 +100,7 @@ def test_asstring(self, a_context, device_datum):
+ assert is_unicode_string(device.attributes.asstring(key))
+ assert device.attributes.asstring(key) == value
+
++ @pytest.mark.skipif(True, reason='Non-deterministic')
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
+ @settings(max_examples=5)
+ def test_asint(self, a_context, device_datum):
+@@ -115,6 +117,7 @@ def test_asint(self, a_context, device_datum):
+ else:
+ assert device.attributes.asint(key) == value
+
++ @pytest.mark.skipif(True, reason='Non-deterministic')
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
+ @settings(max_examples=5)
+ def test_asbool(self, a_context, device_datum):
+diff --git a/tests/_device_tests/_device_tests.py b/tests/_device_tests/_device_tests.py
+index 92a767d..175c611 100644
+--- a/tests/_device_tests/_device_tests.py
++++ b/tests/_device_tests/_device_tests.py
+@@ -378,6 +378,7 @@ def test_getitem_nonexisting(self, a_device):
+ a_device['a non-existing property']
+ assert str(excinfo.value) == repr('a non-existing property')
+
++ @pytest.mark.skipif(True, reason='Non-deterministic')
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
+ @settings(max_examples=5)
+ def test_asint(self, a_context, device_datum):
+@@ -391,6 +392,7 @@ def test_asint(self, a_context, device_datum):
+ else:
+ assert device.asint(property) == value
+
++ @pytest.mark.skipif(True, reason='Non-deterministic')
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
+ @settings(max_examples=5)
+ def test_asbool(self, a_context, device_datum):
+diff --git a/tests/_device_tests/_devices_tests.py b/tests/_device_tests/_devices_tests.py
+index 8eb8069..b80e550 100644
+--- a/tests/_device_tests/_devices_tests.py
++++ b/tests/_device_tests/_devices_tests.py
+@@ -189,8 +189,8 @@ def test_from_device_file(self, a_context, device_datum):
+
+ _device_data = [d for d in _DEVICE_DATA if list(d.device_links)]
+ @pytest.mark.skipif(
+- len(_device_data) == 0,
+- reason='no device with a device node'
++ True,
++ reason='non deterministic'
+ )
+ @given(_CONTEXT_STRATEGY, strategies.sampled_from(_device_data))
+ @settings(max_examples=5, min_satisfying_examples=1)
+diff --git a/tests/test_discover.py b/tests/test_discover.py
+index dd336d5..c410a64 100644
+--- a/tests/test_discover.py
++++ b/tests/test_discover.py
+@@ -155,8 +155,8 @@ def test_name(self, a_device):
+
+ _devices = [d for d in _DEVICES if list(d.device_links)]
+ @pytest.mark.skipif(
+- len(_devices) == 0,
+- reason="no device with device links"
++ True,
++ reason='Non-deterministic'
+ )
+ @given(strategies.sampled_from(_devices))
+ @settings(max_examples=NUM_TESTS, min_satisfying_examples=1)
diff --git a/dev-python/pyudev/pyudev-0.19.0.ebuild b/dev-python/pyudev/pyudev-0.19.0.ebuild
new file mode 100644
index 0000000..bb7b918
--- /dev/null
+++ b/dev-python/pyudev/pyudev-0.19.0.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+
+inherit distutils-r1
+
+DESCRIPTION="Python binding to libudev"
+HOMEPAGE="http://pyudev.readthedocs.org https://github.com/pyudev/pyudev"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+IUSE="pygobject pyqt4 pyside test"
+
+RDEPEND="virtual/udev
+ dev-python/six[${PYTHON_USEDEP}]
+ pygobject? ( dev-python/pygobject:2[$(python_gen_usedep 'python2*')] )
+ pyqt4? ( dev-python/PyQt4[${PYTHON_USEDEP}] )
+ pyside? ( dev-python/pyside[$(python_gen_usedep '!(python3_3)')] )"
+DEPEND="${RDEPEND}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ test? (
+ dev-python/docutils[${PYTHON_USEDEP}]
+ dev-python/hypothesis[${PYTHON_USEDEP}]
+ dev-python/mock[${PYTHON_USEDEP}]
+ >=dev-python/pytest-2.8[${PYTHON_USEDEP}]
+ )"
+
+DOCS=( CHANGES.rst README.rst )
+
+PATCHES=(
+ "${FILESDIR}/${P}-Fixes-for-ID_PATH-parsing.patch"
+ "${FILESDIR}/${P}-skip-non-deterministic-test.patch"
+)
+
+REQUIRED_USE="pygobject? ( || ( $(python_gen_useflags 'python2*') ) )
+ pyside? ( $(python_gen_useflags '!(python3_3)') )"
+
+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
+
+ # test needs needs newer dev-cpp/gccxml
+ rm -f tests/test_libudev.py
+
+ distutils-r1_python_prepare_all
+}
+
+python_test() {
+ py.test || die "Tests fail with ${EPYTHON}"
+}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-python/pyudev/, dev-python/pyudev/files/
@ 2017-04-27 11:13 Tim Harder
0 siblings, 0 replies; 7+ messages in thread
From: Tim Harder @ 2017-04-27 11:13 UTC (permalink / raw
To: gentoo-commits
commit: 8235a0fc89ccefc623538ba4592ab33cb697da5a
Author: Tim Harder <radhermit <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 27 11:09:04 2017 +0000
Commit: Tim Harder <radhermit <AT> gentoo <DOT> org>
CommitDate: Thu Apr 27 11:13:37 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8235a0fc
dev-python/pyudev: remove old
dev-python/pyudev/Manifest | 2 -
.../pyudev-0.19.0-Fixes-for-ID_PATH-parsing.patch | 213 ---------------------
dev-python/pyudev/pyudev-0.16.1-r1.ebuild | 69 -------
dev-python/pyudev/pyudev-0.19.0.ebuild | 62 ------
4 files changed, 346 deletions(-)
diff --git a/dev-python/pyudev/Manifest b/dev-python/pyudev/Manifest
index f2c7dbf42bd..d9b1f98c5d4 100644
--- a/dev-python/pyudev/Manifest
+++ b/dev-python/pyudev/Manifest
@@ -1,4 +1,2 @@
-DIST pyudev-0.16.1.tar.gz 74953 SHA256 765d1c14bd9bd031f64e2612225621984cb2bbb8cbc0c03538bcc4c735ff1c95 SHA512 7f62c6794027411583f874bdf746de457f19048955867d30008bc1ee0d30040a97f73b9e52ae3645d469fc401128703d4e703e294b85481e927ffaba27e45e6a WHIRLPOOL 4c366a1eed92bf274ef84eab6242beb09cd6e906556f6ccb24113fafec2dcc47b8da94487505473fc6f7b39539cdc2809cef2d07a1ab8c0616fc73efba9b2e1a
-DIST pyudev-0.19.0.tar.gz 96556 SHA256 5abcbd03e4965110d1fedcbdd5532974cb4638ceef34337aa2d5758eceb54ad3 SHA512 7faee69e8e3512e27b0d9271191d4b2906652b2c7f3a803be026a10499d184c1fc41db80624dec9f33ee890d71a695214c6bfd47f6cc41b979f71f619836f3f8 WHIRLPOOL 6b496f0f977b97247a13ba4f9f8efe24624d932c6cfc7616922473d8839a90500f60d3b238bbab4a9c9cdd6c5997606ee41de63669e3b2fa868d1b6f28ae492b
DIST pyudev-0.20.0.tar.gz 93217 SHA256 14d85bc9611dbf798732996cb7107858f58a3a1b9d246e4063c7a20ade65842a SHA512 e86a776a2b6d29f206cdd0057c6f9b1e705d981ec8c2de49259887647856531af68238b80751102a3ffc8cea6f234cc520d62c8bc2da686e453ed010da3ebb02 WHIRLPOOL 8344c668c1cc2e7971a67d0e628e3ce96254648ad06b48f260dd4ee54e3e205e533e59b692169b38dd656c08d8cd615d0c7c518b5c2a785553b8c6468e70520c
DIST pyudev-0.21.0.tar.gz 89469 SHA256 094b7a100150114748aaa3b70663485dd360457a709bfaaafe5a977371033f2b SHA512 ba5b6156768b65b9655d809b14378b01173643781b9c4017271e880cdfed442c44ac49eb26c970e4275b820e01678e3001870591fccf88dc713ec941e2b85d11 WHIRLPOOL e69865d8b33ab103e0ff6371df4e05617c3907cbfc98d508285c7464065ccace6dc7d4e963035e19392e6ab39881281e684ddd4f7765fc599874411204ea825b
diff --git a/dev-python/pyudev/files/pyudev-0.19.0-Fixes-for-ID_PATH-parsing.patch b/dev-python/pyudev/files/pyudev-0.19.0-Fixes-for-ID_PATH-parsing.patch
deleted file mode 100644
index 6a9bf659bb9..00000000000
--- a/dev-python/pyudev/files/pyudev-0.19.0-Fixes-for-ID_PATH-parsing.patch
+++ /dev/null
@@ -1,213 +0,0 @@
-commit b1cc8624a2ad8afdc04181ccf6ca42c37a9a701e
-Author: mulhern <amulhern@redhat.com>
-Date: Mon Feb 15 14:13:49 2016 -0500
-
- Fixes for ID_PATH parsing.
-
- * Disable individual fields matching '-'.
- * Do not try to parse delimiter '-' between distinct ids.
- * Change format for a sas path.
- * Handle virtio-pci.
-
- Signed-off-by: mulhern <amulhern@redhat.com>
-
-diff --git a/src/pyudev/_parsing/_id_path.py b/src/pyudev/_parsing/_id_path.py
-index c94f332..0b65c43 100644
---- a/src/pyudev/_parsing/_id_path.py
-+++ b/src/pyudev/_parsing/_id_path.py
-@@ -35,6 +35,16 @@
- from ._shared import Parser
-
-
-+class IdPathField(Field):
-+ """
-+ Overrides default regular expression.
-+ """
-+ # pylint: disable=too-few-public-methods
-+
-+ def __init__(self, name, regexp=r'[^-]+', description=None):
-+ super(IdPathField, self).__init__(name, regexp, description)
-+
-+
- class IdPathParsers(object):
- """
- Aggregate parsers.
-@@ -42,70 +52,73 @@ class IdPathParsers(object):
- # pylint: disable=too-few-public-methods
-
- PARSERS = [
-- Parser(r'acpi-%s', [Field('sys_name')]),
-- Parser(r'ap-%s', [Field('sys_name')]),
-- Parser(r'ata-%s', [Field('port_no')]),
-- Parser(r'bcma-%s', [Field('core')]),
-- Parser(r'cciss-disk%s', [Field('disk')]),
-- Parser(r'ccw-%s', [Field('sys_name')]),
-- Parser(r'ccwgroup-%s', [Field('sys_name')]),
-- Parser(r'fc-%s-%s', [Field('port_name'), Field('lun')]),
-+ Parser(r'acpi-%s', [IdPathField('sys_name')]),
-+ Parser(r'ap-%s', [IdPathField('sys_name')]),
-+ Parser(r'ata-%s', [IdPathField('port_no')]),
-+ Parser(r'bcma-%s', [IdPathField('core')]),
-+ Parser(r'cciss-disk%s', [IdPathField('disk')]),
-+ Parser(r'ccw-%s', [IdPathField('sys_name')]),
-+ Parser(r'ccwgroup-%s', [IdPathField('sys_name')]),
-+ Parser(r'fc-%s-%s', [IdPathField('port_name'), IdPathField('lun')]),
- Parser(
- r'ip-%s:%s-iscsi-%s-%s',
- [
-- Field('persistent_address'),
-- Field('persistent_port'),
-- Field('target_name'),
-- Field('lun')
-+ IdPathField('persistent_address'),
-+ IdPathField('persistent_port'),
-+ IdPathField('target_name'),
-+ IdPathField('lun')
- ]
- ),
-- Parser(r'iucv-%s', [Field('sys_name')]),
-- Parser(r'nst%s', [Field('name')]),
-- Parser(r'pci-%s', [Field('sys_name')]),
-- Parser(r'platform-%s', [Field('sys_name')]),
-- Parser(r'sas-%s-%s', [Field('sas_address'), Field('lun')]),
-+ Parser(r'iucv-%s', [IdPathField('sys_name')]),
-+ Parser(r'nst%s', [IdPathField('name')]),
-+ Parser(r'pci-%s', [IdPathField('sys_name')]),
-+ Parser(r'platform-%s', [IdPathField('sys_name')]),
-+ Parser(r'sas-%s-lun-%s',
-+ [IdPathField('sas_address'), IdPathField('lun')]
-+ ),
- Parser(
- r'sas-exp%s-phy%s-%s',
- [
-- Field(
-+ IdPathField(
- 'sas_address',
- r'.*',
- 'sysfs sas_address attribute of expander'
- ),
-- Field(
-+ IdPathField(
- 'phy_identifier',
- r'.*',
- 'sysfs phy_identifier attribute of target sas device'
- ),
-- Field('lun', description='sysnum of device (0 if none)')
-+ IdPathField('lun', description='sysnum of device (0 if none)')
- ]
- ),
- Parser(
- r'sas-phy%s-%s',
- [
-- Field(
-+ IdPathField(
- 'phy_identifier',
- r'.*',
- 'sysfs phy_identifier attribute of target sas device'
- ),
-- Field('lun', description='sysnum of device (0 if none)')
-+ IdPathField('lun', description='sysnum of device (0 if none)')
- ]
- ),
-- Parser(r'scm-%s', [Field('sys_name')]),
-+ Parser(r'scm-%s', [IdPathField('sys_name')]),
- Parser(
- r'scsi-%s:%s:%s:%s',
- [
-- Field('host'),
-- Field('bus'),
-- Field('target'),
-- Field('lun')
-+ IdPathField('host'),
-+ IdPathField('bus'),
-+ IdPathField('target'),
-+ IdPathField('lun')
- ]
- ),
-- Parser('serio-%s', [Field('sysnum')]),
-- Parser('st%s', [Field('name')]),
-- Parser('usb-0:%s', [Field('port')]),
-- Parser('vmbus-%s-%s', [Field('guid'), Field('lun')]),
-- Parser('xen-%s', [Field('sys_name')])
-+ Parser('serio-%s', [IdPathField('sysnum')]),
-+ Parser('st%s', [IdPathField('name')]),
-+ Parser('usb-0:%s', [IdPathField('port')]),
-+ Parser('virtio-pci-%s', [IdPathField('sys_name')]),
-+ Parser('vmbus-%s-%s', [IdPathField('guid'), IdPathField('lun')]),
-+ Parser('xen-%s', [IdPathField('sys_name')])
- ]
-
-
-@@ -166,6 +179,6 @@ def parse(self, value):
-
- (parser, best_match) = max(matches, key=lambda x: len(x[0].prefix))
- match_list.append((parser, best_match))
-- value = value[len(best_match.group('total')):]
-+ value = value[len(best_match.group('total')) + 1:]
-
- return match_list
-diff --git a/tests/test_parsing.py b/tests/test_parsing.py
-index 619fb01..fba5575 100644
---- a/tests/test_parsing.py
-+++ b/tests/test_parsing.py
-@@ -52,20 +52,27 @@ class TestIDPATH(object):
- Test parsing ID_PATH values.
- """
- # pylint: disable=too-few-public-methods
--
-- @given(
-- strategies.sampled_from(_DEVICES).filter(
-- lambda x: x.get('ID_PATH') is not None
-- )
-+ _devices = [d for d in _DEVICES if d.get('ID_PATH') is not None]
-+ @pytest.mark.skipif(
-+ len(_devices) == 0,
-+ reason="no devices with ID_PATH property"
- )
-+ @given(strategies.sampled_from(_devices))
-+ @settings(min_satisfying_examples=1)
- def test_parsing(self, a_device):
- """
- Test that parsing is satisfactory on all examples.
- """
-+ parsers = _parsing.IdPathParsers.PARSERS
- id_path = a_device.get('ID_PATH')
-- parser = _parsing.IdPathParse(_parsing.IdPathParsers.PARSERS)
-+ parser = _parsing.IdPathParse(parsers)
- result = parser.parse(id_path)
- assert isinstance(result, list) and result != []
-+ assert all(
-+ any(r[1].group('total').startswith(p.prefix) for p in parsers) \
-+ for r in result
-+ )
-+ assert not any(r[1].group('total').startswith('-') for r in result)
-
- _devices = [d for d in _DEVICES if d.get('ID_SAS_PATH') is not None]
- @pytest.mark.skipif(
-@@ -78,10 +85,25 @@ def test_parsing_sas_path(self, a_device):
- """
- Test that parsing is satisfactory on all examples.
- """
-+ parsers = _parsing.IdPathParsers.PARSERS
- id_path = a_device.get('ID_SAS_PATH')
-- parser = _parsing.IdPathParse(_parsing.IdPathParsers.PARSERS)
-+ parser = _parsing.IdPathParse(parsers)
- result = parser.parse(id_path)
- assert isinstance(result, list) and result != []
-+ assert all(
-+ any(r[1].group('total').startswith(p.prefix) for p in parsers) \
-+ for r in result
-+ )
-+ assert not any(r[1].group('total').startswith('-') for r in result)
-+
-+ def test_failure(self):
-+ """
-+ Test at least one failure.
-+ """
-+ id_path = 'pci-0000_09_00_0-sas0x5000155359566200-lun-0'
-+ parser = _parsing.IdPathParse(_parsing.IdPathParsers.PARSERS)
-+ result = parser.parse(id_path)
-+ assert result == []
-
-
- class TestDevlinks(object):
diff --git a/dev-python/pyudev/pyudev-0.16.1-r1.ebuild b/dev-python/pyudev/pyudev-0.16.1-r1.ebuild
deleted file mode 100644
index fbb8061817f..00000000000
--- a/dev-python/pyudev/pyudev-0.16.1-r1.ebuild
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=5
-
-PYTHON_COMPAT=( python{2_7,3_4} )
-
-inherit distutils-r1
-
-DESCRIPTION="Python binding to libudev"
-HOMEPAGE="http://pyudev.readthedocs.org https://github.com/pyudev/pyudev"
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
-
-LICENSE="LGPL-2.1"
-SLOT="0"
-KEYWORDS="amd64 arm ~arm64 x86"
-IUSE="pygobject pyqt4 pyside test"
-
-RDEPEND="virtual/udev
- pygobject? ( dev-python/pygobject:2[$(python_gen_usedep 'python2*')] )
- pyqt4? ( dev-python/PyQt4[${PYTHON_USEDEP}] )
- pyside? ( dev-python/pyside[$(python_gen_usedep '!(python3_3)')] )"
-DEPEND="${RDEPEND}
- dev-python/setuptools[${PYTHON_USEDEP}]
- test? ( dev-python/mock[${PYTHON_USEDEP}]
- dev-python/pytest[${PYTHON_USEDEP}] )"
-
-DOCS=( CHANGES.rst README.rst )
-
-REQUIRED_USE="pygobject? ( || ( $(python_gen_useflags 'python2*') ) )
- pyside? ( $(python_gen_useflags '!(python3_3)') )"
-
-python_prepare_all() {
- # 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
-
- if ! use pygobject; then
- rm pyudev/glib.py || die
- sed -i -e "s|[, ]*GlibBinding()||g" \
- tests/test_observer.py || die
- fi
- if ! use pyqt4; then
- rm pyudev/pyqt4.py || die
- sed -i -e "s|Qt4Binding('PyQt4')[, ]*||g" \
- tests/test_observer.py || die
- fi
- if ! use pyside; then
- rm pyudev/pyside.py || die
- sed -i -e "s|Qt4Binding('PySide')[, ]*||g" \
- tests/test_observer.py || die
- fi
- if ! use pyqt4 && ! use pyside; then
- rm pyudev/_qt_base.py || die
- fi
- if ! use pyqt4 && ! use pyside && ! use pygobject; then
- rm tests/test_observer.py || die
- fi
-
- ewarn "If your PORTAGE_TMPDIR is longer in length then '/var/tmp/',"
- ewarn "change it to /var/tmp to ensure tests will pass."
-
- distutils-r1_python_prepare_all
-}
-
-python_test() {
- py.test || die "Tests fail with ${EPYTHON}"
-}
diff --git a/dev-python/pyudev/pyudev-0.19.0.ebuild b/dev-python/pyudev/pyudev-0.19.0.ebuild
deleted file mode 100644
index 68f3a9457e7..00000000000
--- a/dev-python/pyudev/pyudev-0.19.0.ebuild
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-PYTHON_COMPAT=( python{2_7,3_4} )
-
-inherit distutils-r1
-
-DESCRIPTION="Python binding to libudev"
-HOMEPAGE="http://pyudev.readthedocs.org https://github.com/pyudev/pyudev"
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
-
-LICENSE="LGPL-2.1"
-SLOT="0"
-KEYWORDS="~amd64 ~arm ~arm64 ~x86"
-IUSE="pygobject pyqt4 pyside test"
-
-RDEPEND="virtual/udev
- dev-python/six[${PYTHON_USEDEP}]
- pygobject? ( dev-python/pygobject:2[$(python_gen_usedep 'python2*')] )
- pyqt4? ( dev-python/PyQt4[${PYTHON_USEDEP}] )
- pyside? ( dev-python/pyside[$(python_gen_usedep '!(python3_3)')] )"
-DEPEND="${RDEPEND}
- dev-python/setuptools[${PYTHON_USEDEP}]
- test? (
- dev-python/docutils[${PYTHON_USEDEP}]
- dev-python/hypothesis[${PYTHON_USEDEP}]
- dev-python/mock[${PYTHON_USEDEP}]
- >=dev-python/pytest-2.8[${PYTHON_USEDEP}]
- )"
-
-DOCS=( CHANGES.rst README.rst )
-
-PATCHES=(
- "${FILESDIR}/${P}-Fixes-for-ID_PATH-parsing.patch"
- "${FILESDIR}/${P}-skip-non-deterministic-test.patch"
-)
-
-REQUIRED_USE="pygobject? ( || ( $(python_gen_useflags 'python2*') ) )
- pyside? ( $(python_gen_useflags '!(python3_3)') )"
-
-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
-
- # test needs needs newer dev-cpp/gccxml
- rm -f tests/test_libudev.py
-
- distutils-r1_python_prepare_all
-}
-
-python_test() {
- py.test || die "Tests fail with ${EPYTHON}"
-}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-python/pyudev/, dev-python/pyudev/files/
@ 2020-03-28 21:24 Michał Górny
0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2020-03-28 21:24 UTC (permalink / raw
To: gentoo-commits
commit: 607ec0ecc7bcaeda13ad50a37cb22c32d3abf60b
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 28 21:13:57 2020 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Mar 28 21:24:47 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=607ec0ec
dev-python/pyudev: Remove redundant versions
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
dev-python/pyudev/Manifest | 1 -
...pyudev-0.19.0-skip-non-deterministic-test.patch | 78 ----------------------
dev-python/pyudev/pyudev-0.21.0.ebuild | 55 ---------------
3 files changed, 134 deletions(-)
diff --git a/dev-python/pyudev/Manifest b/dev-python/pyudev/Manifest
index e888f4c61e9..ed167c9a1c1 100644
--- a/dev-python/pyudev/Manifest
+++ b/dev-python/pyudev/Manifest
@@ -1,2 +1 @@
-DIST pyudev-0.21.0.tar.gz 89469 BLAKE2B 3bf9ac46442c5948d131932c7b62a59ef979755f2d55bcd0165fc1b69b865268051fdeab7605c8a1cb0694ce0f4b88f31a1e6a1893900a7300ddf6439734712e SHA512 ba5b6156768b65b9655d809b14378b01173643781b9c4017271e880cdfed442c44ac49eb26c970e4275b820e01678e3001870591fccf88dc713ec941e2b85d11
DIST pyudev-0.22.0.tar.gz 85077 BLAKE2B 66c78aa4d3bea5ceae3660a93e5bd1733629bb5228d67d8e647abb8c237a2786c1061b07e034be5467f5bcab58d95ba30f91d74bdc54cd8253dff69be3ad4a80 SHA512 a09ed479a54a1772a6af68cb975fef792068c2de3655e20223905bc3f574fd32bd3dbe6b97062eee3ab5f08a8b041ad3ea86dfb68c839ea44e29d65ec1686670
diff --git a/dev-python/pyudev/files/pyudev-0.19.0-skip-non-deterministic-test.patch b/dev-python/pyudev/files/pyudev-0.19.0-skip-non-deterministic-test.patch
deleted file mode 100644
index 268d2bdf1b4..00000000000
--- a/dev-python/pyudev/files/pyudev-0.19.0-skip-non-deterministic-test.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-diff --git a/tests/_device_tests/_attributes_tests.py b/tests/_device_tests/_attributes_tests.py
-index 54d8ae6..84e26c3 100644
---- a/tests/_device_tests/_attributes_tests.py
-+++ b/tests/_device_tests/_attributes_tests.py
-@@ -88,6 +88,7 @@ def test_non_iterable(self, a_device):
- with pytest.raises(TypeError):
- a_device.attributes['key']
-
-+ @pytest.mark.skipif(True, reason='Non-deterministic')
- @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
- @settings(max_examples=5)
- def test_asstring(self, a_context, device_datum):
-@@ -99,6 +100,7 @@ def test_asstring(self, a_context, device_datum):
- assert is_unicode_string(device.attributes.asstring(key))
- assert device.attributes.asstring(key) == value
-
-+ @pytest.mark.skipif(True, reason='Non-deterministic')
- @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
- @settings(max_examples=5)
- def test_asint(self, a_context, device_datum):
-@@ -115,6 +117,7 @@ def test_asint(self, a_context, device_datum):
- else:
- assert device.attributes.asint(key) == value
-
-+ @pytest.mark.skipif(True, reason='Non-deterministic')
- @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
- @settings(max_examples=5)
- def test_asbool(self, a_context, device_datum):
-diff --git a/tests/_device_tests/_device_tests.py b/tests/_device_tests/_device_tests.py
-index 92a767d..175c611 100644
---- a/tests/_device_tests/_device_tests.py
-+++ b/tests/_device_tests/_device_tests.py
-@@ -378,6 +378,7 @@ def test_getitem_nonexisting(self, a_device):
- a_device['a non-existing property']
- assert str(excinfo.value) == repr('a non-existing property')
-
-+ @pytest.mark.skipif(True, reason='Non-deterministic')
- @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
- @settings(max_examples=5)
- def test_asint(self, a_context, device_datum):
-@@ -391,6 +392,7 @@ def test_asint(self, a_context, device_datum):
- else:
- assert device.asint(property) == value
-
-+ @pytest.mark.skipif(True, reason='Non-deterministic')
- @given(_CONTEXT_STRATEGY, strategies.sampled_from(_DEVICE_DATA))
- @settings(max_examples=5)
- def test_asbool(self, a_context, device_datum):
-diff --git a/tests/_device_tests/_devices_tests.py b/tests/_device_tests/_devices_tests.py
-index 8eb8069..b80e550 100644
---- a/tests/_device_tests/_devices_tests.py
-+++ b/tests/_device_tests/_devices_tests.py
-@@ -189,8 +189,8 @@ def test_from_device_file(self, a_context, device_datum):
-
- _device_data = [d for d in _DEVICE_DATA if list(d.device_links)]
- @pytest.mark.skipif(
-- len(_device_data) == 0,
-- reason='no device with a device node'
-+ True,
-+ reason='non deterministic'
- )
- @given(_CONTEXT_STRATEGY, strategies.sampled_from(_device_data))
- @settings(max_examples=5, min_satisfying_examples=1)
-diff --git a/tests/test_discover.py b/tests/test_discover.py
-index dd336d5..c410a64 100644
---- a/tests/test_discover.py
-+++ b/tests/test_discover.py
-@@ -155,8 +155,8 @@ def test_name(self, a_device):
-
- _devices = [d for d in _DEVICES if list(d.device_links)]
- @pytest.mark.skipif(
-- len(_devices) == 0,
-- reason="no device with device links"
-+ True,
-+ reason='Non-deterministic'
- )
- @given(strategies.sampled_from(_devices))
- @settings(max_examples=NUM_TESTS, min_satisfying_examples=1)
diff --git a/dev-python/pyudev/pyudev-0.21.0.ebuild b/dev-python/pyudev/pyudev-0.21.0.ebuild
deleted file mode 100644
index 684711ee05c..00000000000
--- a/dev-python/pyudev/pyudev-0.21.0.ebuild
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-PYTHON_COMPAT=( python{3_6,3_7} )
-
-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="amd64 arm ~arm64 ~mips x86"
-IUSE="qt5 test"
-RESTRICT="!test? ( test )"
-
-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}]
- >=dev-python/pytest-2.8[${PYTHON_USEDEP}]
- )"
-
-DOCS=( CHANGES.rst README.rst )
-
-PATCHES=(
- "${FILESDIR}/${PN}-0.19.0-skip-non-deterministic-test.patch"
-)
-
-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
-}
-
-python_test() {
- py.test -v || die "Tests fail with ${EPYTHON}"
-}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-python/pyudev/, dev-python/pyudev/files/
@ 2021-11-19 7:32 Sam James
0 siblings, 0 replies; 7+ messages in thread
From: Sam James @ 2021-11-19 7:32 UTC (permalink / raw
To: gentoo-commits
commit: 82da190150b78c4c9a32aa58a4ea5ba56e2c669c
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 19 07:31:58 2021 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 19 07:31:58 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82da1901
dev-python/pyudev: [QA] "revbump, fix tests, py310"
This reverts commit 7f94bc4ee4f8c40a1ae0b5418b2a08ea3b50507c.
Patch doesn't apply; reverting for now to avoid build failures.
Bug: https://bugs.gentoo.org/824630
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../pyudev/files/pyudev-0.22-fix-hypothesis.patch | 142 ---------------------
dev-python/pyudev/files/pyudev-0.22-pytest-4.patch | 56 --------
.../files/pyudev-0.22-remove-flaky-tests.patch | 126 ------------------
dev-python/pyudev/pyudev-0.22.0-r1.ebuild | 53 --------
4 files changed, 377 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
deleted file mode 100644
index 7489a890edba..000000000000
--- a/dev-python/pyudev/files/pyudev-0.22-fix-hypothesis.patch
+++ /dev/null
@@ -1,142 +0,0 @@
-commit c27845613527091201160a578eacd36a538dea81
-Author: mulhern <amulhern@redhat.com>
-Date: Thu May 3 09:12:26 2018 -0400
-
- Eliminate Hypothesis warnings
-
- * Reduce the max_examples value so that tests don't trigger Hypothesis's
- deadline check.
- * Turn generators into lists, so that Hypothesis can consistently repeat the
- tests (presumably for shrinking).
-
- Signed-off-by: mulhern <amulhern@redhat.com>
-
-diff --git a/tests/_constants.py b/tests/_constants.py
-index fb85f30..7003a5c 100644
---- a/tests/_constants.py
-+++ b/tests/_constants.py
-@@ -53,7 +53,7 @@ def _check_device(device):
- return False
-
-
--_DEVICE_DATA = udev.DeviceDatabase.db()
-+_DEVICE_DATA = [d for d in udev.DeviceDatabase.db()]
- _DEVICES = [Devices.from_path(_CONTEXT, d.device_path) for d in _DEVICE_DATA]
-
-
-@@ -69,7 +69,7 @@ def device_strategy(require_existing=True, filter_func=lambda x: True):
- :type filter_func: Device -> bool
- """
- strategy = strategies.sampled_from(
-- x for x in _CONTEXT.list_devices() if filter_func(x))
-+ [x for x in _CONTEXT.list_devices() if filter_func(x)])
-
- if require_existing:
- strategy = strategy.filter(_check_device)
-@@ -89,7 +89,7 @@ def device_strategy(require_existing=True, filter_func=lambda x: True):
- _SYSNAME_STRATEGY = device_strategy().map(lambda x: x.sys_name)
-
- _PROPERTY_STRATEGY = device_strategy().flatmap(
-- lambda d: strategies.sampled_from(d.properties.items()))
-+ lambda d: strategies.sampled_from([p for p in d.properties.items()]))
-
- _MATCH_PROPERTY_STRATEGY = \
- _PROPERTY_STRATEGY.filter(lambda p: p[0][-4:] != "_ENC")
-@@ -104,7 +104,7 @@ def device_strategy(require_existing=True, filter_func=lambda x: True):
- # an attribute key and value pair
- _ATTRIBUTE_STRATEGY = \
- _ATTRIBUTES_STRATEGY.flatmap(
-- lambda attrs: strategies.sampled_from(attrs.available_attributes).map(
-+ lambda attrs: strategies.sampled_from([a for a in attrs.available_attributes]).map(
- lambda key: (key, attrs.get(key))
- )
- )
-@@ -119,11 +119,11 @@ def device_strategy(require_existing=True, filter_func=lambda x: True):
- )
-
- # the tags object for a given device
--_TAGS_STRATEGY = device_strategy().map(lambda d: d.tags)
-+_TAGS_STRATEGY = device_strategy().map(lambda d: [t for t in d.tags])
-
- # an arbitrary tag belonging to a given device
- _TAG_STRATEGY = \
-- _TAGS_STRATEGY.filter(lambda t: sum(1 for _ in t) != 0).flatmap(
-+ _TAGS_STRATEGY.filter(lambda t: t != []).flatmap(
- strategies.sampled_from
- )
-
-diff --git a/tests/_device_tests/_device_tests.py b/tests/_device_tests/_device_tests.py
-index 0350a10..3e8710a 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=100)
-+ @settings(max_examples=1)
- def test_getitem(self, a_context, device_datum):
- device = Devices.from_path(a_context, device_datum.device_path)
- for prop in device_datum.properties:
-diff --git a/tests/test_discover.py b/tests/test_discover.py
-index e623435..3cf9e8c 100644
---- a/tests/test_discover.py
-+++ b/tests/test_discover.py
-@@ -46,7 +46,7 @@
- from hypothesis import strategies
-
- _CONTEXT = pyudev.Context()
--_DEVICES = _CONTEXT.list_devices()
-+_DEVICES = [d for d in _CONTEXT.list_devices()]
-
- NUM_TESTS = 5
-
-diff --git a/tests/test_enumerate.py b/tests/test_enumerate.py
-index c9c6a67..a9662bd 100644
---- a/tests/test_enumerate.py
-+++ b/tests/test_enumerate.py
-@@ -90,7 +90,7 @@ class TestEnumerator(object):
-
- @failed_health_check_wrapper
- @given(_CONTEXT_STRATEGY, _SUBSYSTEM_STRATEGY)
-- @settings(max_examples=50)
-+ @settings(max_examples=10)
- def test_match_subsystem(self, context, subsystem):
- """
- Subsystem match matches devices w/ correct subsystem.
-@@ -102,7 +102,7 @@ def test_match_subsystem(self, context, subsystem):
-
- @failed_health_check_wrapper
- @given(_CONTEXT_STRATEGY, _SUBSYSTEM_STRATEGY)
-- @settings(max_examples=5)
-+ @settings(max_examples=1)
- def test_match_subsystem_nomatch(self, context, subsystem):
- """
- Subsystem no match gets no subsystem with subsystem.
-@@ -126,7 +126,7 @@ def test_match_subsystem_nomatch_unfulfillable(self, context, subsystem):
-
- @failed_health_check_wrapper
- @given(_CONTEXT_STRATEGY, _SUBSYSTEM_STRATEGY)
-- @settings(max_examples=5)
-+ @settings(max_examples=1)
- def test_match_subsystem_nomatch_complete(self, context, subsystem):
- """
- Test that w/ respect to the universe of devices returned by
-@@ -155,7 +155,7 @@ def test_match_sys_name(self, context, sysname):
-
- @failed_health_check_wrapper
- @given(_CONTEXT_STRATEGY, _MATCH_PROPERTY_STRATEGY)
-- @settings(max_examples=50)
-+ @settings(max_examples=25)
- def test_match_property_string(self, context, pair):
- """
- Match property only gets devices with that property.
-@@ -243,7 +243,7 @@ class TestEnumeratorMatchCombinations(object):
- min_size=2,
- max_size=3,
- unique_by=lambda p: p[0]))
-- @settings(max_examples=20)
-+ @settings(max_examples=2)
- def test_combined_property_matches(self, context, ppairs):
- """
- Test for behaviour as observed in #1
diff --git a/dev-python/pyudev/files/pyudev-0.22-pytest-4.patch b/dev-python/pyudev/files/pyudev-0.22-pytest-4.patch
deleted file mode 100644
index a8a4e4c3bcea..000000000000
--- a/dev-python/pyudev/files/pyudev-0.22-pytest-4.patch
+++ /dev/null
@@ -1,56 +0,0 @@
-commit f962902b8298d97622b97693aba90032e5b9d2ec
-Author: FFY00 <filipe.lains@gmail.com>
-Date: Fri May 24 19:08:41 2019 +0100
-
- tests: fix tests for pytest 4.0
-
-diff --git a/tests/plugins/mock_libudev.py b/tests/plugins/mock_libudev.py
-index aefeb31..0bde07b 100644
---- a/tests/plugins/mock_libudev.py
-+++ b/tests/plugins/mock_libudev.py
-@@ -32,6 +32,7 @@
- from contextlib import contextmanager
- from collections import namedtuple
-
-+import pytest
- import mock
-
- Node = namedtuple('Node', 'name value next')
-@@ -93,5 +94,6 @@ def libudev_list(libudev, function, items):
- EXPOSED_FUNCTIONS = [libudev_list]
-
-
--def pytest_namespace():
-- return dict((f.__name__, f) for f in EXPOSED_FUNCTIONS)
-+def pytest_configure():
-+ for f in EXPOSED_FUNCTIONS:
-+ setattr(pytest, f.__name__, f)
-diff --git a/tests/plugins/privileged.py b/tests/plugins/privileged.py
-index 92328b9..c636980 100644
---- a/tests/plugins/privileged.py
-+++ b/tests/plugins/privileged.py
-@@ -71,5 +71,6 @@ def unload_dummy():
- EXPOSED_FUNCTIONS = [load_dummy, unload_dummy]
-
-
--def pytest_namespace():
-- return dict((f.__name__, f) for f in EXPOSED_FUNCTIONS)
-+def pytest_configure():
-+ for f in EXPOSED_FUNCTIONS:
-+ setattr(pytest, f.__name__, f)
-diff --git a/tests/plugins/travis.py b/tests/plugins/travis.py
-index 46466c2..15a780e 100644
---- a/tests/plugins/travis.py
-+++ b/tests/plugins/travis.py
-@@ -38,8 +38,9 @@ def is_on_travis_ci():
- EXPOSED_FUNCTIONS = [is_on_travis_ci]
-
-
--def pytest_namespace():
-- return dict((f.__name__, f) for f in EXPOSED_FUNCTIONS)
-+def pytest_configure():
-+ for f in EXPOSED_FUNCTIONS:
-+ setattr(pytest, f.__name__, f)
-
-
- def pytest_runtest_setup(item):
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
deleted file mode 100644
index dd5b892606a3..000000000000
--- a/dev-python/pyudev/files/pyudev-0.22-remove-flaky-tests.patch
+++ /dev/null
@@ -1,126 +0,0 @@
-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
deleted file mode 100644
index 08a505993aac..000000000000
--- a/dev-python/pyudev/pyudev-0.22.0-r1.ebuild
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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-pytest-4.patch"
- "${FILESDIR}/pyudev-0.22-remove-flaky-tests.patch"
- "${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
-}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-python/pyudev/, dev-python/pyudev/files/
@ 2021-11-20 0:29 Patrick McLean
0 siblings, 0 replies; 7+ messages in thread
From: Patrick McLean @ 2021-11-20 0:29 UTC (permalink / raw
To: gentoo-commits
commit: b151db9846ae3f0e7175748df4b75f91bd11cca8
Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com>
AuthorDate: Sat Nov 20 00:29:36 2021 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Sat Nov 20 00:29:46 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b151db98
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 <AT> gentoo.org>
.../pyudev/files/pyudev-0.22-fix-hypothesis.patch | 98 ++++++++++++++++
.../files/pyudev-0.22-remove-flaky-tests.patch | 126 +++++++++++++++++++++
dev-python/pyudev/pyudev-0.22.0-r1.ebuild | 51 +++++++++
3 files changed, 275 insertions(+)
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
+}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-python/pyudev/, dev-python/pyudev/files/
@ 2022-01-01 9:23 Arthur Zamarin
0 siblings, 0 replies; 7+ messages in thread
From: Arthur Zamarin @ 2022-01-01 9:23 UTC (permalink / raw
To: gentoo-commits
commit: 7595b65a2fe159d2deab6b7d274638dcbc7a61c2
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 1 09:22:40 2022 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Jan 1 09:23:18 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7595b65a
dev-python/pyudev: disable hypothesis timeouts
Closes: https://bugs.gentoo.org/829862
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
.../pyudev/files/pyudev-0.22-fix-hypothesis.patch | 98 ----------------------
dev-python/pyudev/pyudev-0.22.0-r1.ebuild | 9 +-
2 files changed, 4 insertions(+), 103 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
deleted file mode 100644
index 5a6b27324d82..000000000000
--- a/dev-python/pyudev/files/pyudev-0.22-fix-hypothesis.patch
+++ /dev/null
@@ -1,98 +0,0 @@
-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/pyudev-0.22.0-r1.ebuild b/dev-python/pyudev/pyudev-0.22.0-r1.ebuild
index 622a38c9c9c9..b17a7837de83 100644
--- a/dev-python/pyudev/pyudev-0.22.0-r1.ebuild
+++ b/dev-python/pyudev/pyudev-0.22.0-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
@@ -30,10 +30,6 @@ DEPEND="${RDEPEND}
DOCS=( CHANGES.rst README.rst )
-PATCHES=(
- "${FILESDIR}/pyudev-0.22-fix-hypothesis.patch"
-)
-
distutils_enable_tests pytest
python_prepare_all() {
@@ -47,5 +43,8 @@ python_prepare_all() {
sed -i -e "s|== \('/run/udev'\)|in (\1,'/dev/.udev')|g" \
tests/test_core.py || die
+ # disable use hypothesis timeouts (too short)
+ sed -e '/@settings/s/(/(deadline=None,/' -i tests{,/_device_tests}/*.py || die
+
distutils-r1_python_prepare_all
}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-python/pyudev/, dev-python/pyudev/files/
@ 2024-08-27 17:30 Patrick McLean
0 siblings, 0 replies; 7+ messages in thread
From: Patrick McLean @ 2024-08-27 17:30 UTC (permalink / raw
To: gentoo-commits
commit: 9bc5eb110a8c86181c81eaf8feb75393d8e166d4
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 27 17:29:21 2024 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Tue Aug 27 17:30:13 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9bc5eb11
dev-python/pyudev: add 0.24.3
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
dev-python/pyudev/Manifest | 1 +
dev-python/pyudev/files/pyudev-0.24.3-tests.patch | 13 ++++
dev-python/pyudev/pyudev-0.24.3.ebuild | 77 +++++++++++++++++++++++
3 files changed, 91 insertions(+)
diff --git a/dev-python/pyudev/Manifest b/dev-python/pyudev/Manifest
index b2322adc55a9..874c438f922a 100644
--- a/dev-python/pyudev/Manifest
+++ b/dev-python/pyudev/Manifest
@@ -1 +1,2 @@
DIST pyudev-0.24.1.tar.gz 85963 BLAKE2B 86c6d04691c99671735915564f58b4ef892e45925047487500bc7005343db7145941dde270f4ce9279881bd9bbf203965082d54b34b396febff52f387a1c26ac SHA512 10e32d9a74884000fbf8b86bee60530f6e7b936b990e7ae3b76099ace71834602de404721101c1076ef57365622a9a8f4819d57f58508ced09a21b7d50326886
+DIST pyudev-0.24.3.gh.tar.gz 80807 BLAKE2B 8b047c1d44f9bbb9ace782b690e0859eb3cdc2c1a994a398513e7cc2288803f8cfcdc227546de22275d47961f880bd76e0dec244e46abf451534f5648682febe SHA512 9075437f6fdba0fc1921e252c0a49e1a5eeed8c5cf598856a32aa9f9fcb8885dc0727258d2965241b2e044acfdf70561d5aa3f1380b84e013afc7cb8dcbfce2b
diff --git a/dev-python/pyudev/files/pyudev-0.24.3-tests.patch b/dev-python/pyudev/files/pyudev-0.24.3-tests.patch
new file mode 100644
index 000000000000..a21327df2394
--- /dev/null
+++ b/dev-python/pyudev/files/pyudev-0.24.3-tests.patch
@@ -0,0 +1,13 @@
+diff --git a/tests/_device_tests/_attributes_tests.py b/tests/_device_tests/_attributes_tests.py
+index 71b3a7a..9136cea 100644
+--- a/tests/_device_tests/_attributes_tests.py
++++ b/tests/_device_tests/_attributes_tests.py
+@@ -49,7 +49,7 @@ def test_getitem(self, a_context, device_datum):
+ device = Devices.from_path(a_context, device_datum.device_path)
+ assert all(
+ isinstance(device.attributes.get(key), bytes)
+- for key in device_datum.attributes.keys()
++ for key in device_datum.attributes.keys() if key is not None
+ )
+
+ @given(strategies.sampled_from(_DEVICES))
diff --git a/dev-python/pyudev/pyudev-0.24.3.ebuild b/dev-python/pyudev/pyudev-0.24.3.ebuild
new file mode 100644
index 000000000000..29d6755427f4
--- /dev/null
+++ b/dev-python/pyudev/pyudev-0.24.3.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{9..13} )
+inherit distutils-r1 optfeature pypi
+
+DESCRIPTION="Python binding to libudev"
+HOMEPAGE="https://pyudev.readthedocs.io/en/latest/ https://github.com/pyudev/pyudev"
+SRC_URI="https://github.com/pyudev/pyudev/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86"
+IUSE="qt5"
+
+# Known to fail on test system that aren't exactly the same devices as on CI
+#RESTRICT="test"
+
+RDEPEND="
+ virtual/udev
+"
+BDEPEND="
+ test? (
+ dev-python/docutils[${PYTHON_USEDEP}]
+ dev-python/hypothesis[${PYTHON_USEDEP}]
+ )
+"
+
+DOCS=( CHANGES.rst README.rst )
+
+PATCHES=(
+ "${FILESDIR}/pyudev-0.24.3-tests.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 -e "s|== \('/run/udev'\)|in (\1,'/dev/.udev')|g" \
+ -i tests/test_core.py || die
+
+ # disable usage of hypothesis timeouts (too short)
+ sed -e '/@settings/s/(/(deadline=None,/' -i tests{,/_device_tests}/*.py || die
+
+ # remove GUI tests that require a display server
+ rm tests/test_observer.py tests/test_observer_deprecated.py || die
+
+ distutils-r1_python_prepare_all
+}
+
+python_test() {
+ local -a EPYTEST_DESELECT=(
+ # tests that require root access
+ tests/test_device.py::TestAttributes::test_asint
+ tests/test_device.py::TestAttributes::test_asbool
+ tests/test_device.py::TestAttributes::test_getitem
+ tests/test_device.py::TestAttributes::test_asstring
+
+ # tests don't work on systems that differ from the upstream CI
+ tests/test_monitor.py::TestMonitorObserver::test_deprecated_handler
+ tests/test_monitor.py::TestMonitorObserver::test_fake
+ )
+ epytest tests
+}
+
+pkg_postinst() {
+ optfeature "PyQt5 bindings" "dev-python/PyQt5"
+}
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-08-27 17:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-28 21:24 [gentoo-commits] repo/gentoo:master commit in: dev-python/pyudev/, dev-python/pyudev/files/ Michał Górny
-- strict thread matches above, loose matches on Subject: below --
2024-08-27 17:30 Patrick McLean
2022-01-01 9:23 Arthur Zamarin
2021-11-20 0:29 Patrick McLean
2021-11-19 7:32 Sam James
2017-04-27 11:13 Tim Harder
2016-04-08 2:06 Patrick McLean
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox