Compare commits

..

No commits in common. "rawhide" and "f41" have entirely different histories.

8 changed files with 80 additions and 95 deletions

View file

@ -1 +0,0 @@
1

View file

@ -1,5 +0,0 @@
summary: Basic smoke test
discover:
how: fmf
execute:
how: tmt

View file

@ -1,79 +1,55 @@
# Created by pyp2rpm-3.3.2
%global pypi_name pycotap
Name: python-%{pypi_name}
Version: 1.3.1
Release: 10%{?dist}
Release: 2%{?dist}
Summary: A tiny test runner that outputs TAP results to standard output
License: MIT
URL: https://github.com/remko/pycotap
URL: https://el-tramo.be/pycotap
Source0: %{pypi_source}
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3dist(setuptools)
%description
pycotap is a simple Python test runner for unit tests that outputs Test Anything
Protocol results directly to standard output. Contrary to other TAP runners
Protocol results directly to standard output.Contrary to other TAP runners
for Python, pycotap prints TAP (and *only* TAP) to standard output
instead of to a separate file, allowing you to pipe it directly to TAP pretty
printers and processors.
%package -n python3-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name}
pycotap is a simple Python test runner for unit tests that outputs Test Anything
Protocol results directly to standard output. Contrary to other TAP runners
Protocol results directly to standard output.Contrary to other TAP runners
for Python, pycotap prints TAP (and *only* TAP) to standard output
instead of to a separate file, allowing you to pipe it directly to TAP pretty
printers and processors.
%prep
%autosetup -n %{pypi_name}-%{version}
%generate_buildrequires
%pyproject_buildrequires
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
%build
%pyproject_wheel
%py3_build
%install
%pyproject_install
%pyproject_save_files %{pypi_name}
%py3_install
find %{buildroot}/%{python3_sitelib} -name '*.py' | xargs sed -i '/^#!/d'
%__rm -f %{buildroot}/usr/COPYING
%check
%pyproject_check_import
%files -n python3-%{pypi_name} -f %{pyproject_files}
%files -n python3-%{pypi_name}
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
%changelog
* Fri Sep 19 2025 Python Maint <python-maint@redhat.com> - 1.3.1-10
- Rebuilt for Python 3.14.0rc3 bytecode
* Fri Aug 15 2025 Python Maint <python-maint@redhat.com> - 1.3.1-9
- Rebuilt for Python 3.14.0rc2 bytecode
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Wed Jul 09 2025 Shlomi Fish <shlomif@shlomifish.org> 1.3.1-7
- Stop using deprecated RPM macros ( https://bugzilla.redhat.com/show_bug.cgi?id=2378026 )
* Mon Jun 02 2025 Python Maint <python-maint@redhat.com> - 1.3.1-6
- Rebuilt for Python 3.14
* Thu Feb 13 2025 Shlomi Fish <shlomif@shlomifish.org> 1.3.1-5
- Update URL.
* Sat Jan 18 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Fri Oct 11 2024 Takao Fujiwara <tfujiwar@redhat.com> 1.3.1-3
- Rebuilt for CI
* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

View file

@ -1,5 +0,0 @@
summary: Simple test of python-pycotap
test: ./test.sh
framework: beakerlib
require:
- python3-pycotap

View file

@ -1,37 +0,0 @@
#!/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):
sys.stdout = sys.__stdout__
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()

View file

@ -1,9 +0,0 @@
#!/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

53
tests/tests.py Executable file
View file

@ -0,0 +1,53 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
import unittest
# Need to flush the output against Gtk.main()
def printflush(sentence):
try:
print(sentence, flush=True)
except IOError:
pass
def printerr(sentence):
try:
print(sentence, flush=True, file=sys.stderr)
except IOError:
pass
from pycotap import TAPTestRunner
from pycotap import LogMode
printflush('## Load pycotap')
class AnthyTest(unittest.TestCase):
__test_index = 0
@classmethod
def setUpClass(cls):
printflush('## setUpclass done')
cls.__test_index += 1
def setUp(self):
self.__test_index += 1
printflush('## setUp done')
def test_case1(self):
if self.__test_index != 2:
with self.subTest(i = self.__test_index):
self.fail('setUp does not run: ' + error.message)
printflush('## Test done %d' % self.__test_index)
def main():
loader = unittest.TestLoader()
# Log should be in stderr instead of StringIO
runner = TAPTestRunner(test_output_log=LogMode.LogToError)
unittest.main(testRunner=runner, testLoader=loader)
if __name__ == '__main__':
main()

13
tests/tests.yml Normal file
View file

@ -0,0 +1,13 @@
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-basic
#- role: standard-test-beakerlib
required_packages:
- python3-pycotap
tests:
- smoke1:
dir: .
run: ./tests.py