!15 sync 22.03 to enable make check
From: @yangl777 Reviewed-by: @overweight Signed-off-by: @overweight
This commit is contained in:
commit
342430dc09
116
backport-use-pytest-to-run-the-unittests.patch
Normal file
116
backport-use-pytest-to-run-the-unittests.patch
Normal file
@ -0,0 +1,116 @@
|
||||
From fe60eaf2d6e32ed7009f6d9cfecc1f761ec77560 Mon Sep 17 00:00:00 2001
|
||||
From: Vendula Poncova <vponcova@redhat.com>
|
||||
Date: Thu, 23 Sep 2021 14:43:26 +0200
|
||||
Subject: [PATCH] Use pytest to run the unit tests
|
||||
|
||||
The nose library is no longer maintained and it doesn't work with Python 3.9.
|
||||
|
||||
Conflict:Change the case name based on the current version
|
||||
Reference:https://github.com/daveyoung/kdump-anaconda-addon/commit/fe60eaf2d6e32ed7009f6d9cfecc1f761ec77560
|
||||
|
||||
---
|
||||
Makefile | 4 ++--
|
||||
test/unittests/test_common.py | 6 +++---
|
||||
test/unittests/test_kickstart.py | 16 ++++++++--------
|
||||
3 files changed, 13 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index c9b581d..122d090 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -77,14 +77,14 @@ test:
|
||||
@find . -name '*.py' -print|xargs -n1 --max-procs=$(NUM_PROCS) pylint -E 2> /dev/null
|
||||
@echo "[ OK ]"
|
||||
@echo "***Running unittests checks***"
|
||||
- @PYTHONPATH=. python3 -m nose --processes=-1 -vw test/unittests
|
||||
+ @PYTHONPATH=. pytest -vv test/unittests
|
||||
|
||||
runpylint:
|
||||
@find . -name '*.py' -print|xargs -n1 --max-procs=$(NUM_PROCS) pylint -E 2> /dev/null
|
||||
@echo "[ OK ]"
|
||||
|
||||
unittest:
|
||||
- PYTHONPATH=. python3 -m nose --processes=-1 -vw test/unittests
|
||||
+ PYTHONPATH=. pytest -vv test/unittests
|
||||
|
||||
version.sh:
|
||||
@echo "KDUMP_ADDON_VERSION=$(VERSION)" > version.sh
|
||||
diff --git a/test/unittests/test_common.py b/test/unittests/test_common.py
|
||||
index 7f221be..e7a2ff3 100644
|
||||
--- a/test/unittests/test_common.py
|
||||
+++ b/test/unittests/test_common.py
|
||||
@@ -43,15 +43,15 @@ class MockFileRead(MagicMock):
|
||||
class KdumpCommonTestCase(KdumpTestCase):
|
||||
@patch("builtins.open", MockFileRead(X86_INFO_FIXTURE))
|
||||
@patch("blivet.arch.get_arch", return_value="x86_64")
|
||||
- def memory_bound_test_x86(self, _mock_read):
|
||||
+ def test_memory_bound_x86(self, _mock_read):
|
||||
self.assertEqual((128, 4 * 1024 - 256, 1), common.getMemoryBounds())
|
||||
|
||||
@patch("builtins.open", MockFileRead(AARCH64_INFO_FIXTURE))
|
||||
@patch("blivet.arch.get_arch", return_value="aarch64")
|
||||
- def memory_bound_test_aarch64(self, _mock_read):
|
||||
+ def test_memory_bound_aarch64(self, _mock_read):
|
||||
self.assertEqual((128, 64 * 1024 - 256, 1), common.getMemoryBounds())
|
||||
|
||||
@patch("builtins.open", MockFileRead(PPC64_INFO_FIXTURE))
|
||||
@patch("blivet.arch.get_arch", return_value="ppc64")
|
||||
- def memory_bound_test_ppc64(self, _mock_read):
|
||||
+ def test_memory_bound_ppc64(self, _mock_read):
|
||||
self.assertEqual((256, 64 * 1024 - 1024, 1), common.getMemoryBounds())
|
||||
diff --git a/test/unittests/test_kickstart.py b/test/unittests/test_kickstart.py
|
||||
index 4fb63a9..dc0d357 100644
|
||||
--- a/test/unittests/test_kickstart.py
|
||||
+++ b/test/unittests/test_kickstart.py
|
||||
@@ -25,40 +25,40 @@ def kdump_check_ks(test, addon_data, required_arguments):
|
||||
|
||||
|
||||
class KdumpKickstartTestCase(KdumpTestCase):
|
||||
- def new_ks_addon_data_test(self):
|
||||
+ def test_new_ks_addon_data(self):
|
||||
ks_addon_data = new_ks_addon_data()
|
||||
self.assertIsNotNone(ks_addon_data)
|
||||
|
||||
- def ks_default_to_str_test(self):
|
||||
+ def test_ks_default_to_str(self):
|
||||
ks_addon_data = new_ks_addon_data()
|
||||
kdump_check_ks(self, ks_addon_data, ["--disable"])
|
||||
|
||||
- def ks_enable_to_str_test(self):
|
||||
+ def test_ks_enable_to_str(self):
|
||||
ks_addon_data = new_ks_addon_data()
|
||||
ks_addon_data.enabled = True
|
||||
kdump_check_ks(self, ks_addon_data, ["--enable"])
|
||||
|
||||
- def ks_disable_to_str_test(self):
|
||||
+ def test_ks_disable_to_str(self):
|
||||
ks_addon_data = new_ks_addon_data()
|
||||
ks_addon_data.enabled = False
|
||||
kdump_check_ks(self, ks_addon_data, ["--disable"])
|
||||
|
||||
- def ks_parse_enable_to_str_test(self):
|
||||
+ def test_ks_parse_enable_to_str(self):
|
||||
ks_addon_data = new_ks_addon_data()
|
||||
ks_addon_data.handle_header(0, ["--enable"])
|
||||
kdump_check_ks(self, ks_addon_data, ["--enable"])
|
||||
|
||||
- def ks_parse_reserve_to_str_test(self):
|
||||
+ def test_ks_parse_reserve_to_str(self):
|
||||
ks_addon_data = new_ks_addon_data()
|
||||
ks_addon_data.handle_header(0, ["--enable", "--reserve-mb=256"])
|
||||
kdump_check_ks(self, ks_addon_data, ["--enable", "--reserve-mb[=|\ ](\"256\"|'256'|256)[Mm]?"])
|
||||
|
||||
- def ks_parse_fadump_to_str_test(self):
|
||||
+ def test_ks_parse_fadump_to_str(self):
|
||||
ks_addon_data = new_ks_addon_data()
|
||||
ks_addon_data.handle_header(0, ['--enablefadump'])
|
||||
kdump_check_ks(self, ks_addon_data, ["--enablefadump"])
|
||||
|
||||
- def ks_parse_invalid_reserve_size_test(self):
|
||||
+ def test_ks_parse_invalid_reserve_size(self):
|
||||
with self.assertRaises(KickstartParseError) as error:
|
||||
ks_addon_data = new_ks_addon_data()
|
||||
ks_addon_data.handle_header(0, ['--reserve-mb='])
|
||||
--
|
||||
2.33.0
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
Name: kdump-anaconda-addon
|
||||
Version: 005
|
||||
Release: 6
|
||||
Release: 11
|
||||
Summary: Anaconda addon for configuring kdump.
|
||||
License: GPLv2
|
||||
URL: https://github.com/daveyoung/kdump-anaconda-addon
|
||||
@ -34,8 +34,9 @@ Patch6023: fix-an-unittest-error.patch
|
||||
Patch6024: replace-getSysroot.patch
|
||||
Patch6025: use-kernel-arguments-instead-of-cmdline.patch
|
||||
Patch6026: dont-use-the-local-storage-object.patch
|
||||
Patch6027: backport-use-pytest-to-run-the-unittests.patch
|
||||
|
||||
BuildRequires: intltool gettext
|
||||
BuildRequires: intltool gettext python3-pytest python3-blivet anaconda >= 29.24
|
||||
Requires: anaconda >= 29.24 hicolor-icon-theme
|
||||
|
||||
Obsoletes: kexec-tools-anaconda-addon < 2.0.17-9
|
||||
@ -58,6 +59,7 @@ installation media.
|
||||
%find_lang kdump-anaconda-addon
|
||||
|
||||
%check
|
||||
make unittest
|
||||
|
||||
%pre
|
||||
|
||||
@ -74,8 +76,14 @@ installation media.
|
||||
%{_datadir}/icons/hicolor/scalable/apps/kdump.svg
|
||||
|
||||
%changelog
|
||||
* Mon Jun 06 2022 yanglu <yanglu72@h-partners.com> - 005-11
|
||||
- DESC: enable make check
|
||||
|
||||
* Thu Apr 28 2021 yanglu <yanglu72@h-partners.com> - 005-10
|
||||
- DESC: rebuild package
|
||||
|
||||
* Mon Aug 09 2021 chenyanpanHW <chenyanpan@huawei.com> - 005-6
|
||||
- DESC: delete -Sgit from %autosetup, and delete BuildRequires git
|
||||
- DESC: delete -Sgit from autosetup, and delete BuildRequires git
|
||||
|
||||
* Sat Aug 7 2021 yangzhuangzhuang <yangzhuangzhuang1@huawei.com> - 005-5
|
||||
- revert "update version to 006"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user