Skip to content

Commit 16ba437

Browse files
committed
tests: Fix make check with GitHub action
The test scripts invoke anthytest.py whose unittest can skip tests unless Display is available and the return value has been changed since Python 3.12.1 No pycotap.__main__ and cannot be directly executed with `-m` option. Fedora 39 Docker does not provide USER environment variable. Fixes: b279e15
1 parent a68fa27 commit 16ba437

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

tests/test-build.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ ANTHY_SCHEMA_FILE=org.freedesktop.ibus.engine.anthy.gschema.xml;
2828
SCHEMA_TMPDIR="";
2929
FORCE_TEST="";
3030
RUN_ARGS="";
31+
# Fedora 39 Docker does not provide USER
32+
USER=${USER:-`id | sed -e "s/uid=[0-9]*(\([^)]*\)).*/\1/"`};
3133

3234
usage()
3335
{
@@ -73,7 +75,8 @@ maybe_install_pycotap() {
7375
fi;
7476

7577
# Check if pycotap is already available.
76-
if ! python3 -m pycotap >/dev/null; then
78+
# No pycotap.__main__ and cannot be directly executed with `-m` option
79+
if ! python3 -c "import pycotap"; then
7780
PIP=pip3
7881
if ! command -v $PIP &> /dev/null ; then
7982
PIP=pip
@@ -122,7 +125,8 @@ init_environment()
122125

123126
run_ibus_daemon()
124127
{
125-
ibus-daemon --daemonize --verbose --panel disable;
128+
# this script can run without Display
129+
ibus-daemon --daemonize --verbose --panel disable --emoji-extension disable;
126130
sleep 1;
127131
SUSER=`echo "$USER" | cut -c 1-7`;
128132
ps -ef | grep "$SUSER" | grep ibus | grep -v grep;
@@ -141,8 +145,10 @@ run_test_suite()
141145
env IBUS_ANTHY_ENGINE_PATH=$SRCDIR/../engine/python$i \
142146
IBUS_ANTHY_SETUP_PATH=$SRCDIR/../setup/python$i \
143147
python$i -u $SRCDIR/anthytest.py $RUN_ARGS;
144-
if test $? -ne 0 ; then
145-
exit -1;
148+
RETVAL=$?
149+
# Return 5 with "NO TESTS RAN" in unittest/runner.py since python 3.12.1
150+
if test $RETVAL -ne 0 && test $RETVAL -ne 5; then
151+
exit 1;
146152
fi;
147153
if test x$FORCE_TEST = x ; then
148154
rm -r $HOME/.anthy;

tests/test-console.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ PID_XORG=0;
3434
PID_GNOME_SESSION=0;
3535
FORCE_TEST="";
3636
RUN_ARGS="--exit";
37+
# Fedora 39 Docker does not provide USER
38+
USER=${USER:-`id | sed -e "s/uid=[0-9]*(\([^)]*\)).*/\1/"`};
3739

3840
usage()
3941
{
@@ -152,8 +154,10 @@ run_test_suite()
152154
echo "#### Starting $PYTHON API test $RUN_ARGS";
153155
export GTK_IM_MODULE=ibus
154156
$PYTHON -u $SRCDIR/anthytest.py $RUN_ARGS;
155-
if test $? -ne 0 ; then
156-
exit -1;
157+
RETVAL=$?
158+
# Return 5 with "NO TESTS RAN" in unittest/runner.py since python 3.12.1
159+
if test $RETVAL -ne 0 && test $RETVAL -ne 5; then
160+
exit 1;
157161
fi;
158162
if test x$FORCE_TEST = x ; then
159163
for ANTHY_CONFIG in ".anthy" ".config/anthy" ; do

0 commit comments

Comments
 (0)