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
This commit is contained in:
parent
1a0b1cd795
commit
a0c7d6d2fb
2 changed files with 12 additions and 11 deletions
3
plan.fmf
3
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: |
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue