Skip to content

Commit

Permalink
CP rhel_ver_match(N-x) optional format
Browse files Browse the repository at this point in the history
  • Loading branch information
damoore044 committed Dec 5, 2024
1 parent 0fdb820 commit d3702f0
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions pytest_plugins/fixture_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,26 @@ def pytest_generate_tests(metafunc):
# process eventual rhel_version_match markers
matchers = [i.args for i in function_marks if i.name == 'rhel_ver_match']
match_params = []
for matcher in matchers:
match_params.extend(
[
setting_rhel_ver
for setting_rhel_ver in settings.supportability.content_hosts.rhel.versions
if re.fullmatch(str(matcher[0]), str(setting_rhel_ver))
]
)
if matchers and len(matchers[0][0]) == 3 and matchers[0][0].startswith('N-'):
# num of desired prior versions
num_versions = int(matchers[0][0].split('-')[1])
# grab major versions, excluding fips, from tail of supportability list
filtered_versions = [
setting_rhel_ver
for setting_rhel_ver in settings.supportability.content_hosts.rhel.versions
if 'fips' not in str(setting_rhel_ver)
][-(num_versions + 1) :] # inclusive (+1) to collect N as well
match_params.extend(filtered_versions)
# match versions with existing regex markers
else:
for matcher in matchers:
match_params.extend(
[
setting_rhel_ver
for setting_rhel_ver in settings.supportability.content_hosts.rhel.versions
if re.fullmatch(str(matcher[0]), str(setting_rhel_ver))
]
)
network_params = ['ipv6' if settings.server.is_ipv6 else 'ipv4']
rhel_params = []
ids = []
Expand Down

0 comments on commit d3702f0

Please sign in to comment.