Convert STI to tmt plan

This commit is contained in:
Lukáš Zachar 2026-08-17 10:14:37 +02:00
parent aa275fb893
commit c8e42e2e9d
6 changed files with 52 additions and 58 deletions

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

47
plan.fmf Normal file
View File

@ -0,0 +1,47 @@
discover:
how: shell
dist-git-source: true
tests:
- name: smoke
test: pybabel --list-locales
- name: smoke2
test: /usr/libexec/platform-python smoke.py
path: /tests
- name: unit tests
test: |
cleanup(){
if [[ -n $TmpDir ]] && test -d $TmpDir; then
rm -rf $TmpDir
fi
}
trap cleanup EXIT
TmpDir=$(mktemp -d)
# first, copy over unit tests and make them find the installed modules and
# files as if they were an exploded source tarball
cp -r $TMT_SOURCE_DIR/Babel-*/tests $TmpDir/
# test_frontend needs python3-freezegun
rm $TmpDir/tests/messages/test_frontend.py
BABELDIR="$(/usr/libexec/platform-python -c 'import os.path; import babel; print(os.path.dirname(babel.__file__))')"
ln -snf "$BABELDIR" $TmpDir/babel
pushd $TmpDir
# run the tests
export TZ=America/New_York
pytest-3
popd
execute:
how: tmt
prepare:
- name: install packages
how: install
package:
- python3-babel
- python3-pytest

View File

@ -1,8 +0,0 @@
#!/bin/bash
# smoke tests for the babel runtime
# bail out on any error
set -e
pybabel --list-locales

View File

@ -1,27 +0,0 @@
#!/bin/bash
# Run Babel's unit tests with the installed packages.
# bail out if anything goes wrong
set -e
# run in its own subdirectory without the whole sources underneath
mkdir testrun
# first, copy over unit tests and make them find the installed modules and
# files as if they were an exploded source tarball
cp -r source/tests testrun/
# test_frontend needs python3-freezegun
rm testrun/tests/messages/test_frontend.py
BABELDIR="$(python3 -c 'import os.path; import babel; print(os.path.dirname(babel.__file__))')"
ln -snf "$BABELDIR" testrun/babel
pushd testrun
# run the tests
export TZ=America/New_York
pytest-3
popd # testrun

4
tests/smoke.py Normal file
View File

@ -0,0 +1,4 @@
from datetime import date
from babel.dates import format_date
assert format_date(date(2021,3,1), locale='en') == 'Mar 1, 2021'

View File

@ -1,23 +0,0 @@
---
- hosts: localhost
roles:
- role: standard-test-source
tags:
- always
- role: standard-test-basic
tags:
- atomic
- classic
required_packages:
- babel
- coreutils
- python3-babel
- python3-pytest
tests:
- smoke:
dir: .
run: ./run-smoke-tests.sh
- verify:
dir: .
run: ./run-unit-tests-on-installed-pkg.sh