From e796618c648e03c5955d4998c5b801e89bc285ff Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Fri, 11 Oct 2024 09:26:11 +0900 Subject: [PATCH] Add CI TMT Resolves: RHEL-62167 --- .fmf/version | 1 + plans/test.fmf | 5 +++++ tests/base/main.fmf | 5 +++++ tests/base/test.py | 36 ++++++++++++++++++++++++++++++++++++ tests/base/test.sh | 9 +++++++++ 5 files changed, 56 insertions(+) create mode 100644 .fmf/version create mode 100644 plans/test.fmf create mode 100644 tests/base/main.fmf create mode 100755 tests/base/test.py create mode 100755 tests/base/test.sh 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/plans/test.fmf b/plans/test.fmf new file mode 100644 index 0000000..c1627f9 --- /dev/null +++ b/plans/test.fmf @@ -0,0 +1,5 @@ +summary: Basic smoke test +discover: + how: fmf +execute: + how: tmt diff --git a/tests/base/main.fmf b/tests/base/main.fmf new file mode 100644 index 0000000..d657f11 --- /dev/null +++ b/tests/base/main.fmf @@ -0,0 +1,5 @@ +summary: Simple test of python-pycotap +test: ./test.sh +framework: beakerlib +require: + - python3-pycotap diff --git a/tests/base/test.py b/tests/base/test.py new file mode 100755 index 0000000..3c350e9 --- /dev/null +++ b/tests/base/test.py @@ -0,0 +1,36 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- + +import unittest +import sys + +from pycotap import TAPTestRunner +from pycotap import LogMode + + +class SimpleTest(unittest.TestCase): + @classmethod + def function_name(cls): + return sys._getframe().f_back.f_code.co_name + + @classmethod + def setUpClass(cls): + print(cls.function_name()) + + def setUp(self): + print(SimpleTest.function_name()) + + def main(self): + print(SimpleTest.function_name()) + + def test_foo(self): + print(SimpleTest.function_name()) + + +def main(): + loader = unittest.TestLoader() + runner = TAPTestRunner(test_output_log=LogMode.LogToError) + unittest.main(testRunner=runner, testLoader=loader) + +if __name__ == '__main__': + main() diff --git a/tests/base/test.sh b/tests/base/test.sh new file mode 100755 index 0000000..b61d891 --- /dev/null +++ b/tests/base/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartTest + rlRun -t "./test.py" + rlPhaseEnd +rlJournalEnd