From f5c3e22084f896c05af52a68791c4d13dbf25bc0 Mon Sep 17 00:00:00 2001 From: Denis Efremov Date: Fri, 9 Feb 2024 15:41:41 +0400 Subject: [PATCH] tests: Unify missing backports tests exceptions Signed-off-by: Denis Efremov --- pytest.ini | 1 + tests/conftest.py | 16 ++++++++++++++++ tests/test_01_on_branch.py | 17 ++--------------- tests/test_06_on_branch_all_files.py | 17 ++--------------- 4 files changed, 21 insertions(+), 30 deletions(-) diff --git a/pytest.ini b/pytest.ini index 66ac3ba..04e8810 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,4 +1,5 @@ [pytest] +pythonpath = tests minversion = 6.0 norecursedirs = linux addopts = -rA --show-capture=stderr diff --git a/tests/conftest.py b/tests/conftest.py index 0e995fd..4f40475 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,6 +8,22 @@ from git import Repo from subprocess import run +missing_backports = [ + ('CVE-2019-12455', 'stable/linux-4.19.y'), # Disputed + ('CVE-2021-4037', 'stable/linux-4.19.y'), + ('CVE-2022-0998', 'stable/linux-5.15.y'), + ('CVE-2022-1789', 'stable/linux-4.19.y'), + ('CVE-2022-1789', 'stable/linux-5.4.y'), + ('CVE-2022-3061', 'stable/linux-4.19.y'), + ('CVE-2022-3061', 'stable/linux-5.4.y'), + ('CVE-2023-4133', 'stable/linux-4.19.y'), + ('CVE-2023-4133', 'stable/linux-5.4.y'), + ('CVE-2023-4133', 'stable/linux-5.10.y'), + ('CVE-2023-4133', 'stable/linux-5.15.y'), + ('CVE-2023-4133', 'stable/linux-6.1.y'), + ('CVE-2023-23005', 'stable/linux-6.1.y'), +] + def mount_tmpfs(target, req_mem_gb): if os.path.ismount(target): return True diff --git a/tests/test_01_on_branch.py b/tests/test_01_on_branch.py index 7753ec3..b63d45f 100644 --- a/tests/test_01_on_branch.py +++ b/tests/test_01_on_branch.py @@ -1,26 +1,13 @@ #!/usr/bin/env python3 import pytest +from conftest import missing_backports from cvehound.exception import UnsupportedVersion @pytest.mark.fast @pytest.mark.notbackported( ('cve', 'branch'), - [ - ('CVE-2019-12455', 'stable/linux-4.19.y'), # Disputed - ('CVE-2021-4037', 'stable/linux-4.19.y'), - ('CVE-2022-0998', 'stable/linux-5.15.y'), - ('CVE-2022-1789', 'stable/linux-4.19.y'), - ('CVE-2022-1789', 'stable/linux-5.4.y'), - ('CVE-2022-3061', 'stable/linux-4.19.y'), - ('CVE-2022-3061', 'stable/linux-5.4.y'), - ('CVE-2023-4133', 'stable/linux-4.19.y'), - ('CVE-2023-4133', 'stable/linux-5.4.y'), - ('CVE-2023-4133', 'stable/linux-5.10.y'), - ('CVE-2023-4133', 'stable/linux-5.15.y'), - ('CVE-2023-4133', 'stable/linux-6.1.y'), - ('CVE-2023-23005', 'stable/linux-6.1.y'), - ] + missing_backports ) def test_on_branch(hound, branch, cve): try: diff --git a/tests/test_06_on_branch_all_files.py b/tests/test_06_on_branch_all_files.py index 82f8279..bdaa2e7 100644 --- a/tests/test_06_on_branch_all_files.py +++ b/tests/test_06_on_branch_all_files.py @@ -1,26 +1,13 @@ #!/usr/bin/env python3 import pytest +from conftest import missing_backports from cvehound.exception import UnsupportedVersion @pytest.mark.slow @pytest.mark.notbackported( ('cve', 'branch'), - [ - ('CVE-2019-12455', 'stable/linux-4.19.y'), # Disputed - ('CVE-2021-4037', 'stable/linux-4.19.y'), - ('CVE-2022-0998', 'stable/linux-5.15.y'), - ('CVE-2022-1789', 'stable/linux-4.19.y'), - ('CVE-2022-1789', 'stable/linux-5.4.y'), - ('CVE-2022-3061', 'stable/linux-4.19.y'), - ('CVE-2022-3061', 'stable/linux-5.4.y'), - ('CVE-2023-4133', 'stable/linux-4.19.y'), - ('CVE-2023-4133', 'stable/linux-5.4.y'), - ('CVE-2023-4133', 'stable/linux-5.10.y'), - ('CVE-2023-4133', 'stable/linux-5.15.y'), - ('CVE-2023-4133', 'stable/linux-6.1.y'), - ('CVE-2023-23005', 'stable/linux-6.1.y'), - ] + missing_backports ) def test_on_branch(hound, branch, cve): try: