From a0c7d6d2fbe89c77775185444cd2549f0763cedf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zachar?= Date: Thu, 14 Aug 2025 16:45:13 +0200 Subject: [PATCH] Change all_supplementing_pythons to work with tmt If there are no special fmf features used, fmf is a plain yaml. Which is case here so there is no need to use 'fmf' to parse plan.fmf --- plan.fmf | 3 +-- tests/all_supplementing_pythons.py | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/plan.fmf b/plan.fmf index 827567e..c1a605f 100644 --- a/plan.fmf +++ b/plan.fmf @@ -21,8 +21,7 @@ discover: dist-git-download-only: true tests: - name: all_supplementing_pythons - path: /tests - test: ./all_supplementing_pythons.py + test: ./tests/all_supplementing_pythons.py - name: mock_with_tests # Needs cwd to contain downloaded sources, path to mocktes.sh depends on tmt tree structure test: | diff --git a/tests/all_supplementing_pythons.py b/tests/all_supplementing_pythons.py index 223bdf1..a473ae2 100755 --- a/tests/all_supplementing_pythons.py +++ b/tests/all_supplementing_pythons.py @@ -8,7 +8,7 @@ See https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproje This script: 1) figures out all packages in the enabled repositories supplementing tox - 2) ensures there is a venv.sh test for each of them in tests.yml + 2) ensures there is a venv.sh test for each of them in plan.fmf That way, when we change tox (update, patch, etc.), we will always test it with all Pythons that supplement it. @@ -34,16 +34,18 @@ def parse_python_test_arg(command): # First, construct a set of various Pythons we test, e.g. {python3.10, python3.7, pypy3.6, ...} tested_pythons = set() -with open('tests.yml') as f: - tests_yml = yaml.safe_load(f) +with open('plan.fmf') as f: + plan_fmf = yaml.safe_load(f) # this nested structure access is quite fragile, # but at least it should fail the test if we reach to a wrong place -for test in tests_yml[-1]['roles'][0]['tests']: - for value in test.values(): - run = value['run'] - if run.endswith('./venv.sh'): - tested_pythons.add(parse_python_test_arg(run)) -print('Tested Pythons found in tests.yml:', file=sys.stderr) +for discover_section in plan_fmf['discover']: + if discover_section['name'] != 'tests_python': + continue + for test in discover_section['tests']: + test_cmd = test['test'] + if test_cmd.endswith('./venv.sh'): + tested_pythons.add(parse_python_test_arg(test_cmd)) +print('Tested Pythons found in plan.fmf:', file=sys.stderr) for python in sorted(tested_pythons): print(' ', python, file=sys.stderr)