From c8e42e2e9d66eeac9ab15e3ad3a067ec05900fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zachar?= Date: Mon, 17 Aug 2026 10:14:37 +0200 Subject: [PATCH] Convert STI to tmt plan --- .fmf/version | 1 + plan.fmf | 47 ++++++++++++++++++++++++ tests/run-smoke-tests.sh | 8 ---- tests/run-unit-tests-on-installed-pkg.sh | 27 -------------- tests/smoke.py | 4 ++ tests/tests.yml | 23 ------------ 6 files changed, 52 insertions(+), 58 deletions(-) create mode 100644 .fmf/version create mode 100644 plan.fmf delete mode 100755 tests/run-smoke-tests.sh delete mode 100755 tests/run-unit-tests-on-installed-pkg.sh create mode 100644 tests/smoke.py delete mode 100644 tests/tests.yml diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/plan.fmf b/plan.fmf new file mode 100644 index 0000000..4c7176f --- /dev/null +++ b/plan.fmf @@ -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 diff --git a/tests/run-smoke-tests.sh b/tests/run-smoke-tests.sh deleted file mode 100755 index 68eef0c..0000000 --- a/tests/run-smoke-tests.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# smoke tests for the babel runtime - -# bail out on any error -set -e - -pybabel --list-locales diff --git a/tests/run-unit-tests-on-installed-pkg.sh b/tests/run-unit-tests-on-installed-pkg.sh deleted file mode 100755 index 053ccf0..0000000 --- a/tests/run-unit-tests-on-installed-pkg.sh +++ /dev/null @@ -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 diff --git a/tests/smoke.py b/tests/smoke.py new file mode 100644 index 0000000..4364761 --- /dev/null +++ b/tests/smoke.py @@ -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' diff --git a/tests/tests.yml b/tests/tests.yml deleted file mode 100644 index a9c5680..0000000 --- a/tests/tests.yml +++ /dev/null @@ -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