summaryrefslogtreecommitdiff
path: root/sys-block/bmap-tools
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-03-31 22:06:41 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-03-31 22:06:41 +0100
commit9ab9a2c6661b7cb6bbaeeb3fbdfedd7546b0142f (patch)
tree8e2efb08866063f75d3d4927f8ac76e6554d4704 /sys-block/bmap-tools
parent569e3558cac0a0ecdc6b80debb515b5ed8515df9 (diff)
gentoo auto-resync : 31:03:2023 - 22:06:41
Diffstat (limited to 'sys-block/bmap-tools')
-rw-r--r--sys-block/bmap-tools/Manifest4
-rw-r--r--sys-block/bmap-tools/bmap-tools-3.6-r1.ebuild (renamed from sys-block/bmap-tools/bmap-tools-3.6.ebuild)27
-rw-r--r--sys-block/bmap-tools/files/bmap-tools-3.6-mock-import-pattern.patch94
-rw-r--r--sys-block/bmap-tools/files/bmap-tools-3.6-unittest-mock.patch44
4 files changed, 157 insertions, 12 deletions
diff --git a/sys-block/bmap-tools/Manifest b/sys-block/bmap-tools/Manifest
index 9e33e722fccd..dc2700b26913 100644
--- a/sys-block/bmap-tools/Manifest
+++ b/sys-block/bmap-tools/Manifest
@@ -1,3 +1,5 @@
+AUX bmap-tools-3.6-mock-import-pattern.patch 4569 BLAKE2B 4cfab7a0a262b4de495a05d4d8b02c94d5fd84d1fea78565c522c61be5250e95124b866eefba23240833d7c9ba138eb48fad9f8383a08c21ca07810905a05890 SHA512 60d3227076ba67d0097646cdabc9fe05aa7dec6d0f39cef45f71b05f6bde8e60aae585820d342bb5ed50c7d3c52565742e27c7e9dcd5f5184f7be8b42bd87326
+AUX bmap-tools-3.6-unittest-mock.patch 1356 BLAKE2B 802c93a72ccd5bd8f33598b914822b3f61a4bd26ed57769ecd5a10d0216c97916b2818847bc2c0cde4020707c21fb7248c88e0a90c21112568f45020b22466c7 SHA512 c83973282651da8b6a296d71c5c46c4078c2b539ec53cac2c0973c039dbe8416f248aa7fd6235ec40d05b99523f80380cbc4f2d2cc62afced45fecd645748b89
DIST bmap-tools-3.6.tar.gz 97815 BLAKE2B 3c6728386d66283a4df0376c90d2eafc670bba835ca97ebe25ab12f5eb1f745dea9a55d8c287c815306b9d603b6d804f9711a19b2df23870355983ebce4c0a07 SHA512 a55fe88d8f136b39f2bb92690322ae65d66ae1ae0454050d74bd37a39d69dca6428ba05ff42d2faf8e83f8f8342d882caaf8bb45aa00c74bbd5e4b12289a406a
-EBUILD bmap-tools-3.6.ebuild 1195 BLAKE2B 9c988adefb933523fd8e496e56bd5ff07a71eadd2ad107875bb157f437085dff39f58b2de581ed5ffe2746ec1abde632d4fc10087cc67ab84984b93f9a60cae8 SHA512 f0ac7a35f3220d5b373e3ec52ee7f036de589b931fdd8fcd318877d12d6cb2a36f06cbb49d510ae2e89e2be26d06fe7f43e2889e5af38921c5175215a4973129
+EBUILD bmap-tools-3.6-r1.ebuild 1421 BLAKE2B dc3991fdf16d079bcb5864cef544d40a4d9ad56ece5a05bd109c8d1a4eeddfed3555d965f1e2d8e3f3153bdb763ff9a42b4b74909118366785b253d3102dbfcb SHA512 520211301ad4effb5804d0eedc281c74ce027fb9a901152bf4b2781a9d47d8998915f27af32575e11df2152532a43bacd1c42be59e2640afee3bcdd1b8b24ab0
MISC metadata.xml 333 BLAKE2B 7d820818b65fc7613da7dabf60482e9352294892c7c6e8d7e8c9df91dc6d24edcaf42404b5d7f7f1d1f35cd338df6b395cc5c491d4f6eaa8cf375a270ae83436 SHA512 31b122594ac46064ce59088c934c7718a738bf1b15e29b1e196daf32ffce59cfdedaf1f9a16c0da30936d9c2954c22c882989bc3d002f80b13c4e0082fd42677
diff --git a/sys-block/bmap-tools/bmap-tools-3.6.ebuild b/sys-block/bmap-tools/bmap-tools-3.6-r1.ebuild
index 5ba041f67df6..5a474a6f2428 100644
--- a/sys-block/bmap-tools/bmap-tools-3.6.ebuild
+++ b/sys-block/bmap-tools/bmap-tools-3.6-r1.ebuild
@@ -1,8 +1,9 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=7
-PYTHON_COMPAT=( python3_{9..10} )
+EAPI=8
+PYTHON_COMPAT=( python3_{9..11} )
+DISTUTILS_USE_PEP517=setuptools
inherit distutils-r1
@@ -24,8 +25,7 @@ IUSE="test"
BDEPEND="${PYTHON_DEPS}
dev-python/setuptools[${PYTHON_USEDEP}]
- test? ( dev-python/nose[${PYTHON_USEDEP}]
- dev-python/six[${PYTHON_USEDEP}] )
+ test? ( dev-python/six[${PYTHON_USEDEP}] )
"
RDEPEND="
@@ -41,14 +41,19 @@ RDEPEND="
DOCS=( "${S}/docs/README" )
+PATCHES=(
+ "${FILESDIR}"/${P}-unittest-mock.patch
+ "${FILESDIR}"/${P}-mock-import-pattern.patch
+)
+
# tests are hanging using default below
RESTRICT="!test? ( test )"
-distutils_enable_tests nose
-
-python_test() {
+EPYTEST_DESELECT=(
# remaining tests involve way too much file I/O
- nosetests -sx --verbosity=3 --detailed-errors \
- tests/test_bmap_helpers.py \
- tests/test_compat.py || die "Tests fail with ${EPYTHON}"
-}
+ tests/test_api_base.py # too many open files
+ tests/test_bmap_helpers.py::TestBmapHelpers::test_get_file_system_type_symlink # depends on backports.tempfile
+ tests/test_bmap_helpers.py::TestBmapHelpers::test_is_zfs_configuration_compatible_unreadable_file # fails
+)
+
+distutils_enable_tests pytest
diff --git a/sys-block/bmap-tools/files/bmap-tools-3.6-mock-import-pattern.patch b/sys-block/bmap-tools/files/bmap-tools-3.6-mock-import-pattern.patch
new file mode 100644
index 000000000000..cb27ff08ac36
--- /dev/null
+++ b/sys-block/bmap-tools/files/bmap-tools-3.6-mock-import-pattern.patch
@@ -0,0 +1,94 @@
+Upstream commit: https://github.com/intel/bmap-tools/commit/47908b5389d1f3de9306c0030856b3d3180ade86
+Related Gentoo bug: https://bugs.gentoo.org/833258
+
+I had to change the first hunk a bit to also remove `backports`
+
+From 47908b5389d1f3de9306c0030856b3d3180ade86 Mon Sep 17 00:00:00 2001
+From: Simon McVittie <smcv@debian.org>
+Date: Thu, 28 Oct 2021 12:23:30 +0100
+Subject: [PATCH] tests: Fix import pattern for mock objects
+
+The legacy mock module contains a mock.mock submodule, but unittest.mock
+does not contain a redundant unittest.mock.mock. This bug was masked by
+the transparent fallback to the legacy mock module.
+
+The actual test only uses mock.patch(), so we can simplify by just
+importing the one member that we need.
+
+Fixes: a1ca1172 "tests: Use unittest.mock from Python standard library if possible"
+Signed-off-by: Simon McVittie <smcv@debian.org>
+---
+ tests/test_bmap_helpers.py | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/tests/test_bmap_helpers.py b/tests/test_bmap_helpers.py
+index 56b079e..36c4557 100644
+--- a/tests/test_bmap_helpers.py
++++ b/tests/test_bmap_helpers.py
+@@ -22,10 +22,9 @@
+ import sys
+ import tempfile
+ try:
+- from unittest.mock import patch, mock
++ from unittest.mock import patch
+ except ImportError: # for Python < 3.3
+- from mock import patch, mock
+-from backports import tempfile as btempfile
++ from mock import patch
+ from bmaptools import BmapHelpers
+
+
+@@ -76,7 +76,7 @@ def test_is_zfs_configuration_compatible_enabled(self):
+ delete=True, dir=".", suffix=".txt") as fobj:
+ fobj.write("1")
+ fobj.flush()
+- mockobj = mock.patch.object(BmapHelpers, "ZFS_COMPAT_PARAM_PATH", fobj.name)
++ mockobj = patch.object(BmapHelpers, "ZFS_COMPAT_PARAM_PATH", fobj.name)
+ with mockobj:
+ self.assertTrue(BmapHelpers.is_zfs_configuration_compatible())
+
+@@ -88,7 +88,7 @@ def test_is_zfs_configuration_compatible_disabled(self):
+ delete=True, dir=".", suffix=".txt") as fobj:
+ fobj.write("0")
+ fobj.flush()
+- mockobj = mock.patch.object(BmapHelpers, "ZFS_COMPAT_PARAM_PATH", fobj.name)
++ mockobj = patch.object(BmapHelpers, "ZFS_COMPAT_PARAM_PATH", fobj.name)
+ with mockobj:
+ self.assertFalse(BmapHelpers.is_zfs_configuration_compatible())
+
+@@ -97,7 +97,7 @@ def test_is_zfs_configuration_compatible_invalid_read_value(self):
+
+ with tempfile.NamedTemporaryFile("a", prefix="testfile_",
+ delete=True, dir=".", suffix=".txt") as fobj:
+- mockobj = mock.patch.object(BmapHelpers, "ZFS_COMPAT_PARAM_PATH", fobj.name)
++ mockobj = patch.object(BmapHelpers, "ZFS_COMPAT_PARAM_PATH", fobj.name)
+ with self.assertRaises(BmapHelpers.Error):
+ with mockobj:
+ BmapHelpers.is_zfs_configuration_compatible()
+@@ -116,7 +116,7 @@ def test_is_zfs_configuration_compatible_notinstalled(self):
+
+ directory = os.path.dirname(__file__)
+ filepath = os.path.join(directory, "BmapHelpers/file/does/not/exist")
+- mockobj = mock.patch.object(BmapHelpers, "ZFS_COMPAT_PARAM_PATH", filepath)
++ mockobj = patch.object(BmapHelpers, "ZFS_COMPAT_PARAM_PATH", filepath)
+ with mockobj:
+ self.assertFalse(BmapHelpers.is_zfs_configuration_compatible())
+
+@@ -128,7 +128,7 @@ def test_is_compatible_file_system_zfs_valid(self, mock_get_fs_type): #pylint: d
+ delete=True, dir=".", suffix=".img") as fobj:
+ fobj.write("1")
+ fobj.flush()
+- mockobj = mock.patch.object(BmapHelpers, "ZFS_COMPAT_PARAM_PATH", fobj.name)
++ mockobj = patch.object(BmapHelpers, "ZFS_COMPAT_PARAM_PATH", fobj.name)
+ with mockobj:
+ self.assertTrue(BmapHelpers.is_compatible_file_system(fobj.name))
+
+@@ -140,7 +140,7 @@ def test_is_compatible_file_system_zfs_invalid(self, mock_get_fs_type): #pylint:
+ delete=True, dir=".", suffix=".img") as fobj:
+ fobj.write("0")
+ fobj.flush()
+- mockobj = mock.patch.object(BmapHelpers, "ZFS_COMPAT_PARAM_PATH", fobj.name)
++ mockobj = patch.object(BmapHelpers, "ZFS_COMPAT_PARAM_PATH", fobj.name)
+ with mockobj:
+ self.assertFalse(BmapHelpers.is_compatible_file_system(fobj.name))
+
diff --git a/sys-block/bmap-tools/files/bmap-tools-3.6-unittest-mock.patch b/sys-block/bmap-tools/files/bmap-tools-3.6-unittest-mock.patch
new file mode 100644
index 000000000000..9c509f227a1f
--- /dev/null
+++ b/sys-block/bmap-tools/files/bmap-tools-3.6-unittest-mock.patch
@@ -0,0 +1,44 @@
+Upstream commit: https://github.com/intel/bmap-tools/commit/a1ca1172f259f32ff9eb0469567be1a9085cca88
+Related Gentoo bug: https://bugs.gentoo.org/833258
+
+From a1ca1172f259f32ff9eb0469567be1a9085cca88 Mon Sep 17 00:00:00 2001
+From: Simon McVittie <smcv@debian.org>
+Date: Thu, 28 Oct 2021 11:03:09 +0100
+Subject: [PATCH] tests: Use unittest.mock from Python standard library if
+ possible
+
+This avoids an unnecessary external dependency when using Python >= 3.3.
+
+Signed-off-by: Simon McVittie <smcv@debian.org>
+---
+ requirements-test.txt | 2 +-
+ tests/test_bmap_helpers.py | 5 ++++-
+ 2 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/requirements-test.txt b/requirements-test.txt
+index 1cc6bbb..cea340a 100644
+--- a/requirements-test.txt
++++ b/requirements-test.txt
+@@ -1,4 +1,4 @@
+ six
+ nose
+ backports.tempfile
+-mock
+\ No newline at end of file
++mock ; python_version < '3.3'
+diff --git a/tests/test_bmap_helpers.py b/tests/test_bmap_helpers.py
+index 1617957..47b3862 100644
+--- a/tests/test_bmap_helpers.py
++++ b/tests/test_bmap_helpers.py
+@@ -21,7 +21,10 @@
+ import os
+ import sys
+ import tempfile
+-from mock import patch, mock
++try:
++ from unittest.mock import patch, mock
++except ImportError: # for Python < 3.3
++ from mock import patch, mock
+ from backports import tempfile as btempfile
+ from bmaptools import BmapHelpers
+