LibreOffice not disposed when UItest failing with python >= 3.11

Xisco Fauli xiscofauli at libreoffice.org
Wed Dec 20 15:30:13 UTC 2023


Hello,

I realized that if python 3.11 or newer is used ( tested with python 
3.12 using pyenv ), a failing UItest doesn't dispose LibreOffice.

How to reproduce it:

1. Modify a UITest so it fails with 'Could not find child with id':

#########

diff --git a/sc/qa/uitest/key_f4/f4.py b/sc/qa/uitest/key_f4/f4.py
index d132dd5ac2cc..41659458d6fc 100644
--- a/sc/qa/uitest/key_f4/f4.py
+++ b/sc/qa/uitest/key_f4/f4.py
@@ -17,7 +17,7 @@ class keyF4(UITestCase):
      def test_f4(self):
          with self.ui_test.create_doc_in_start_center("calc") as document:
              xCalcDoc = self.xUITest.getTopFocusWindow()
-            gridwin = xCalcDoc.getChild("grid_window")
+            gridwin = xCalcDoc.getChild("testgrid_window")
              #enter data
              enter_text_to_cell(gridwin, "A1", "1")
              enter_text_to_cell(gridwin, "A2", "2")

#########

2. Create a bash script like:

#########

export SRCDIR=$PWD
export PYTHONPATH=$SRCDIR/instdir/program:unotest/source/python
export URE_BOOTSTRAP=file://$SRCDIR/instdir/program/fundamentalrc
export TestUserDir=file:///tmp
export SAL_USE_VCLPLUGIN=gen
export LC_ALL=C

rm -rf /tmp/libreoffice/4

python3 "$SRCDIR"/uitest/test_main.py 
--soffice=path:"$SRCDIR"/instdir/program/soffice 
--userdir=file:///tmp/libreoffice/4 
--file="$SRCDIR/sc/qa/uitest/key_f4/f4.py"

#########

3. Run the script. it fails with 'undisposed bridge "" in state 2, 
potential deadlock ahead'. See logs: https://paste.ee/p/6eYZI

4. Run it again. it fails to connect to LibreOffice because there is 
already an instance running. See logs: https://paste.ee/p/AWjrb

So unless the process is killed manually, it's not possible to execute 
UItests again.

OTOH, if it's executed using python 3.10, if fails as expected with 
'Could not find child with id' and LibreOffice is disposed correctly. 
See logs: https://paste.ee/p/A3YCQ

I see the same problem if 'make UITest_key_f4' is used.

Checking in alma linux, the python version is 3.6.8 so the CI is not 
affected at the moment, but it might be in the future.

-- 
Xisco Faulí
LibreOffice QA Team
IRC: x1sc0



More information about the LibreOffice mailing list