Use pycotap instead of tappy in CI

- Revise CI from ibus-typing-booster
- Delete _python_bytecompile_extra
This commit is contained in:
Takao Fujiwara 2020-07-09 22:57:02 +09:00
parent c68416fc79
commit 2bce534c0c
3 changed files with 186 additions and 15 deletions

View File

@ -444,3 +444,173 @@ index 5fd3040..340e8ef 100644
-- --
2.21.0 2.21.0
From 390d6273096fe0e435a0d145e6a785f38372ba67 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 2 Jul 2020 14:47:39 +0900
Subject: [PATCH] tests: Enable pycotap
---
tests/anthytest.py | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/tests/anthytest.py b/tests/anthytest.py
index 11d0e2b..03a7c31 100755
--- a/tests/anthytest.py
+++ b/tests/anthytest.py
@@ -20,10 +20,23 @@ import sys
import subprocess
import unittest
+TAP_MODULE_NONE, \
+TAP_MODULE_TAPPY, \
+TAP_MODULE_PYCOTAP = list(range(3))
+
+tap_module = TAP_MODULE_NONE
+
try:
from tap import TAPTestRunner
-except ModuleNotFoundError as err:
- print('Ignore tap module: %s' % str(err))
+ tap_module = TAP_MODULE_TAPPY
+ print('Load tappy')
+except ModuleNotFoundError:
+ try:
+ from pycotap import TAPTestRunner
+ tap_module = TAP_MODULE_PYCOTAP
+ print('Load pycotap')
+ except ModuleNotFoundError as err:
+ print('Ignore tap module: %s' % str(err))
PY3K = sys.version_info >= (3, 0)
DONE_EXIT = True
@@ -344,7 +357,8 @@ def main():
if args.tap:
loader = unittest.TestLoader()
runner = TAPTestRunner()
- runner.set_stream(True)
+ if tap_module == TAP_MODULE_TAPPY:
+ runner.set_stream(True)
unittest.main(testRunner=runner, testLoader=loader)
else:
unittest.main()
--
2.24.1
From f4f35c32942a649d67fb52730d7a5d4f2ef5058a Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 9 Jul 2020 20:20:57 +0900
Subject: [PATCH] tests: Use unittest.fail and unittest.skipIf
---
tests/anthytest.py | 39 +++++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/tests/anthytest.py b/tests/anthytest.py
index 03a7c31..bff3078 100755
--- a/tests/anthytest.py
+++ b/tests/anthytest.py
@@ -5,10 +5,12 @@ from __future__ import print_function
from gi import require_version as gi_require_version
gi_require_version('GLib', '2.0')
+gi_require_version('Gdk', '3.0')
gi_require_version('Gio', '2.0')
gi_require_version('Gtk', '3.0')
gi_require_version('IBus', '1.0')
from gi.repository import GLib
+from gi.repository import Gdk
from gi.repository import Gio
from gi.repository import Gtk
from gi.repository import IBus
@@ -66,6 +68,7 @@ def printerr(sentence):
except IOError:
pass
+@unittest.skipIf(Gdk.Display.open('') == None, 'Display cannot be open.')
class AnthyTest(unittest.TestCase):
global DONE_EXIT
ENGINE_PATH = '/com/redhat/IBus/engines/Anthy/Test/Engine'
@@ -84,7 +87,7 @@ class AnthyTest(unittest.TestCase):
def register_ibus_engine(self):
self.__bus = IBus.Bus()
if not self.__bus.is_connected():
- error('ibus-daemon is not running')
+ self.fail('ibus-daemon is not running')
return False;
self.__bus.get_connection().signal_subscribe('org.freedesktop.DBus',
'org.freedesktop.DBus',
@@ -130,12 +133,24 @@ class AnthyTest(unittest.TestCase):
interface_name, signal_name, parameters,
user_data):
if signal_name == 'NameOwnerChanged':
- import engine
+ try:
+ import engine
+ except ModuleNotFoundError as e:
+ with self.subTest(i = 'name-owner-changed'):
+ self.fail('NG: Not installed ibus-anthy %s' % str(e))
+ Gtk.main_quit()
+ return
engine.Engine.CONFIG_RELOADED()
def __create_engine_cb(self, factory, engine_name):
if engine_name == 'testanthy':
- import engine
+ try:
+ import engine
+ except ModuleNotFoundError as e:
+ with self.subTest(i = 'create-engine'):
+ self.fail('NG: Not installed ibus-anthy %s' % str(e))
+ Gtk.main_quit()
+ return
self.__id += 1
self.__engine = engine.Engine(self.__bus, '%s/%d' % (self.ENGINE_PATH, self.__id))
self.__engine.connect('focus-in', self.__engine_focus_in)
@@ -178,7 +193,8 @@ class AnthyTest(unittest.TestCase):
def __set_engine_cb(self, object, res):
if not self.__bus.set_global_engine_async_finish(res):
- warning('set engine failed: ' + error.message)
+ with self.subTest(i = self.__test_index):
+ self.fail('set engine failed: ' + error.message)
return
self.__enable_hiragana()
self.__main_test()
@@ -238,18 +254,14 @@ class AnthyTest(unittest.TestCase):
type = list(cases.keys())[0]
i = 0
if type == 'string':
- if start == -1 and end == -1:
- printflush('test step: %s sequences: "%s"' \
- % (tag, str(cases['string'])))
+ printflush('test step: %s sequences: "%s"' \
+ % (tag, str(cases['string'])))
for a in cases['string']:
if start >= 0 and i < start:
i += 1
continue
if end >= 0 and i >= end:
break;
- if start != -1 or end != -1:
- printflush('test step: %s sequences: "%s"' \
- % (tag, str(cases['string'])))
self.__typing(ord(a), 0, 0)
i += 1
if type == 'keys':
@@ -279,8 +291,11 @@ class AnthyTest(unittest.TestCase):
if cases['string'] == chars:
printflush('OK: %d %s' % (self.__test_index, chars))
else:
- printflush('NG: %d %s %s' \
- % (self.__test_index, str(cases['string']), chars))
+ with self.subTest(i = self.__test_index):
+ self.fail('NG: %d %s %s' \
+ % (self.__test_index, str(cases['string']), chars))
+ if DONE_EXIT:
+ Gtk.main_quit()
self.__test_index += 1
if self.__test_index == len(TestCases['tests']):
if DONE_EXIT:
--
2.24.1

View File

@ -1,7 +1,4 @@
# This package depends on automagic byte compilation # https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_3
# https://fedoraproject.org/wiki/Changes/No_more_automagic_Python_bytecompilation_phase_2
%global _python_bytecompile_extra 1
%global sub_version 1.0 %global sub_version 1.0
%global require_ibus_version 1.5.3 %global require_ibus_version 1.5.3
%global have_default_layout 1 %global have_default_layout 1
@ -32,7 +29,7 @@
Name: ibus-anthy Name: ibus-anthy
Version: 1.5.11 Version: 1.5.11
Release: 6%{?dist} Release: 7%{?dist}
Summary: The Anthy engine for IBus input platform Summary: The Anthy engine for IBus input platform
License: GPLv2+ License: GPLv2+
URL: https://github.com/ibus/ibus/wiki URL: https://github.com/ibus/ibus/wiki
@ -107,6 +104,7 @@ for developers.
%package tests %package tests
Summary: Tests for the %{name} package Summary: Tests for the %{name} package
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python3-pycotap
%description tests %description tests
The %{name}-tests package contains tests that can be used to verify The %{name}-tests package contains tests that can be used to verify
@ -205,6 +203,11 @@ touch --no-create %{_datadir}/icons/hicolor || :
%{_datadir}/installed-tests/%{name} %{_datadir}/installed-tests/%{name}
%changelog %changelog
* Thu Jul 09 2020 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.11-7
- Use pycotap instead of tappy in CI
- Revise CI from ibus-typing-booster
- Delete _python_bytecompile_extra
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.11-6 * Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.11-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

View File

@ -53,15 +53,11 @@
args: args:
chdir: gnome-desktop-testing chdir: gnome-desktop-testing
- name: Install tap.py
shell: |
TAP_DIR=`python -m site --user-site`/tap
if [ x"$TAP_DIR" != x -a ! -d "$TAP_DIR" ] ; then
echo "pip install tap.py --user"
pip install tap.py --user
fi
- name: Start IBus installed-tests testing harness - name: Start IBus installed-tests testing harness
environment:
ANSIBLE: 1
TMPDIR: '{{ remote_artifacts }}'
G_MESSAGES_DEBUG: 'all'
block: block:
- name: Execute IBus tests - name: Execute IBus tests
shell: | shell: |
@ -73,10 +69,10 @@
if [ -f $HOME/.anthy/last-record2_default.utf8 ] ; then \ if [ -f $HOME/.anthy/last-record2_default.utf8 ] ; then \
rm $HOME/.anthy/last-record2_default.utf8 rm $HOME/.anthy/last-record2_default.utf8
fi fi
env TMPDIR='{{ remote_artifacts }}' G_MESSAGES_DEBUG='all' \
ibus-desktop-testing-runner \ ibus-desktop-testing-runner \
--no-graphics \ --no-graphics \
--runner=gnome \ --runner=gnome \
--timeout=1200 \
--tests='{{ installed_test_name }}' \ --tests='{{ installed_test_name }}' \
--output='{{ remote_artifacts }}/{{ installed_test_name }}.log' \ --output='{{ remote_artifacts }}/{{ installed_test_name }}.log' \
--result='{{ remote_artifacts }}/test.log' \ --result='{{ remote_artifacts }}/test.log' \
@ -92,10 +88,12 @@
log="{{ remote_artifacts }}/test.log" log="{{ remote_artifacts }}/test.log"
if [ ! -f $log ] ; then if [ ! -f $log ] ; then
echo ERROR echo ERROR
exit 1
else else
FAIL=`grep "^FAIL: " {{ remote_artifacts }}/test.log | grep -v 'FAIL: 0$'` FAIL=`grep "^FAIL: " {{ remote_artifacts }}/test.log | grep -v 'FAIL: 0$'`
if [ x"$FAIL" != x ] ; then if [ x"$FAIL" != x ] ; then
echo ERROR echo ERROR
exit 1
else else
echo PASS echo PASS
fi fi