Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ImportError in tests for almalinux package #833

Merged
merged 1 commit into from
May 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions alws/utils/oval_add_al8_gpg_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,15 @@
from copy import deepcopy
from typing import Any, Dict, List, Optional, Tuple

from almalinux.liboval.composer import Composer, Definition, RpminfoState, RpminfoTest

try:
from almalinux.liboval.composer import (
Composer,
Definition,
RpminfoState,
RpminfoTest,
)
except ImportError:
pass

# AL8 GPG keys ids
GPG_KEYS = ['51d6647ec21ad6ea', '2ae81e8aced7258b']
Expand All @@ -105,7 +112,7 @@ def get_next(self):

def convert_sign_criterion_to_criteria(
root_criteria: List[Dict[str, Any]],
old_to_new_tests_map: Dict[str, List[RpminfoTest]],
old_to_new_tests_map: Dict[str, Any],
):
"""
Converts single sign criterion to criteria with multiple sign criterion with new tests.
Expand Down Expand Up @@ -151,7 +158,7 @@ def traverse_criteria(criteria_list):
return fixed_criteria


def get_first_available_ids(oval: Composer) -> Tuple[int, int]:
def get_first_available_ids(oval) -> Tuple[int, int]:
"""
Returns the first available test ID and state ID in the given Composer object.

Expand All @@ -168,9 +175,7 @@ def get_first_available_ids(oval: Composer) -> Tuple[int, int]:
return max_test_id + 1, max_state_id + 1


def generate_gpg_keys_states(
states_counter: IdCounter, original_state: RpminfoState
) -> List[RpminfoState]:
def generate_gpg_keys_states(states_counter, original_state) -> List:
"""
Generate GPG keys states original state.

Expand All @@ -194,8 +199,8 @@ def generate_gpg_keys_states(


def get_new_tests_states(
oval: Composer,
) -> Tuple[List[RpminfoTest], List[RpminfoState], Dict[str, List[RpminfoTest]]]:
oval,
) -> Tuple[List, List, Dict[str, List]]:
"""
Generates new tests and states based on the given Oval Composer.

Expand Down Expand Up @@ -251,7 +256,7 @@ def get_new_tests_states(
return new_tests, new_states, old_to_new_test_map


def add_multiple_gpg_keys_to_oval(oval: Composer) -> Composer:
def add_multiple_gpg_keys_to_oval(oval):
"""
Adds support for multiple GPG keys to the given Oval Composer object.

Expand Down