Skip to content

Commit

Permalink
tests: correctly handle different Python prefixes
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Reber <[email protected]>
  • Loading branch information
adrianreber committed Sep 25, 2024
1 parent 9289ba6 commit ef888f9
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/ci/spec_to_test_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
# and which tests to enable in the test suite.
# This script will return three shell arrays (TESTS, ADMIN_TESTS and PKGS).

import os
import sys
import csv
import os

# This dictionary defines the mapping
# 'path/to/file.spec': [
Expand Down Expand Up @@ -255,6 +256,22 @@
],
}

# Check which base OS we are using
reader = csv.DictReader(open('/etc/os-release'), delimiter="=")

python_prefix = 'python3'

for row in reader:
key = row.pop('NAME')
if key in ['ID_LIKE', 'ID']:
for item in list(row.items())[0]:
if 'rhel' in item:
python_prefix = 'python3.11'
break
if 'suse' in item:
python_prefix = 'python311'
break

skip_ci_specs = []
skip_ci_specs_env = os.getenv('SKIP_CI_SPECS')
if skip_ci_specs_env:
Expand Down Expand Up @@ -286,6 +303,8 @@
admin_tests += f'--enable-{test_map[i][1]}'
pkgs += test_map[i][2]

pkgs = pkgs.replace('python3', python_prefix)

print(
'TESTS=(%s) ADMIN_TESTS=(%s) PKGS=(%s)' % (
tests,
Expand Down

0 comments on commit ef888f9

Please sign in to comment.