Bug 131835 - UITests fail with python3.8
Summary: UITests fail with python3.8
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
7.0.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Noel Grandin
URL:
Whiteboard: target:7.0.0
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-02 20:45 UTC by Rene Engelhard
Modified: 2020-05-14 15:04 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rene Engelhard 2020-04-02 20:45:29 UTC
since https://cgit.freedesktop.org/libreoffice/core/commit/?id=8ea5a522f76dd089446e901f3cd324f98cd973e7https://cgit.freedesktop.org/libreoffice/core/commit/?id=8ea5a522f76dd089446e901f3cd324f98cd973e7 (I guess) the following happens because the test throws a warning:

[build UIT] librelogo
S=/home/rene/LibreOffice/git/master && I=$S/instdir && W=$S/workdir &&  rm -rf $W/UITest/librelogo/ && mkdir -p $W/UITest/librelogo//user/user && cp $S/qadevOOo/qa/registrymodifications.xcu $W/UITest/librelogo//user/user/ &&  rm -fr $W/UITest/librelogo/done.core && mkdir -p $W/UITest/librelogo/user/ && mkdir $W/UITest/librelogo/done.core && cd $W/UITest/librelogo/done.core &&   (   TDOC="$S/sw/qa/uitest/writer_tests/data"   TEST_LIB=$W/LinkTarget/Library/libtest.so URE_BOOTSTRAP=vnd.sun.star.pathname:$I/program/fundamentalrc PYTHONPATH="$S/uitest:$S/unotest/source/python:$I/program:$S/sw/qa/uitest/librelogo/" TestUserDir="file://$W/UITest/librelogo/" PYTHONDONTWRITEBYTECODE=0 PYTHONWARNINGS=error MAX_CONCURRENCY=4 MOZILLA_CERTIFICATE_FOLDER= SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION=1 SAL_USE_VCLPLUGIN=svp LIBO_LANG=C   /usr/bin/python3 $S/uitest/test_main.py --soffice="path:$I/program/soffice" --userdir=file://$W/UITest/librelogo/user --dir=$S/sw/qa/uitest/librelogo/  2>&1)
False
test_librelogo (run.LibreLogoTest) ... OfficeConnection: connecting to: uno:pipe,name=pytest027c5cb0-7518-11ea-b079-2016b9f1e514;urp;StarOffice.ComponentContext
NoConnectException: sleeping...
['OnNew']
OnCreate
['OnNew']
OnStorageChanged
['OnNew']
OnTitleChanged
['OnNew']
OnFocus
['OnNew']
OnViewCreated
['OnNew']
OnPageCountChange
['OnNew']
OnLayoutFinished
1
Execution time for run.LibreLogoTest.test_librelogo: 0.417
tearDown: calling terminate()...
...done
ERROR
test_compile_librelogo (compile.LibreLogoCompileTest) ... OfficeConnection: connecting to: uno:pipe,name=pytest03737748-7518-11ea-b079-2016b9f1e514;urp;StarOffice.ComponentContext
NoConnectException: sleeping...
Execution time for compile.LibreLogoCompileTest.test_compile_librelogo: 0.050
close
tearDown: calling terminate()...
...done
ERROR

======================================================================
ERROR: test_librelogo (run.LibreLogoTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rene/LibreOffice/git/master/sw/qa/uitest/librelogo/run.py", line 42, in test_librelogo
    xIsAlive = self.getScript("__is_alive__")
  File "/home/rene/LibreOffice/git/master/sw/qa/uitest/librelogo/run.py", line 29, in getScript
    xScript = xScriptProvider.getScript(self.LIBRELOGO_PATH %command)
run.com.sun.star.script.provider.ScriptFrameworkErrorException: ProviderCache::createProvider() Error creating provider from factory. python-loader:<class 'DeprecationWarning'>: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses, traceback follows
  File "/home/rene/LibreOffice/git/master/instdir/program/pythonloader.py", line 22, in <module>
    import imp
  File "/home/rene/LibreOffice/git/master/instdir/program/uno.py", line 356, in _uno_import
    return _builtin_import(name, *optargs, **kwargs)
  File "/usr/lib/python3.8/imp.py", line 31, in <module>
    warnings.warn("the imp module is deprecated in favour of importlib; "



======================================================================
ERROR: test_compile_librelogo (compile.LibreLogoCompileTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rene/LibreOffice/git/master/sw/qa/uitest/librelogo/compile.py", line 36, in test_compile_librelogo
    xCompile = self.getScript("__compil__")
  File "/home/rene/LibreOffice/git/master/sw/qa/uitest/librelogo/compile.py", line 30, in getScript
    xScript = xScriptProvider.getScript(self.LIBRELOGO_PATH %command)
run.com.sun.star.script.provider.ScriptFrameworkErrorException: ProviderCache::createProvider() Error creating provider from factory. python-loader:<class 'DeprecationWarning'>: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses, traceback follows
  File "/home/rene/LibreOffice/git/master/instdir/program/pythonloader.py", line 22, in <module>
    import imp
  File "/home/rene/LibreOffice/git/master/instdir/program/uno.py", line 356, in _uno_import
    return _builtin_import(name, *optargs, **kwargs)
  File "/usr/lib/python3.8/imp.py", line 31, in <module>
    warnings.warn("the imp module is deprecated in favour of importlib; "



----------------------------------------------------------------------
Ran 2 tests in 2.755s

FAILED (errors=2)
Tests run: 2
Tests failed: 0
Tests errors: 2
Tests skipped: 0

This is

rene@frodo:~/LibreOffice/git/master$ python3 --version
Python 3.8.2
rene@frodo:~/LibreOffice/git/master$
Comment 1 Rene Engelhard 2020-04-02 20:55:24 UTC
rene@frodo:~/LibreOffice/git/master$ git grep "import imp"
pyuno/source/loader/pythonloader.py:import imp
scripting/source/pyprov/pythonscript.py:import imp
sd/qa/uitest/impress_tests/customSlideShow.py:import importlib
sd/qa/uitest/impress_tests/slideShowSettings.py:import importlib
solenv/gdb/autoload.template:import importlib
sw/qa/uitest/table/tdf128593.py:import importlib
testtools/source/bridgetest/pyuno/main.py:import importer
testtools/source/bridgetest/pyuno/main.py:import impl
uitest/loginterpreter.py:    "import importlib\n\n" + \
uitest/test_main.py:import importlib
uitest/test_main.py:import importlib.machinery
uitest/ui_logger_dsl/dsl_core.py:            + "import importlib\n\n"
wizards/com/sun/star/wizards/agenda/AgendaWizardDialogResources.py:        import imp, os
wizards/com/sun/star/wizards/common/NoValidPathException.py:            import imp, os
wizards/com/sun/star/wizards/fax/FaxWizardDialogResources.py:        import imp, os
wizards/com/sun/star/wizards/letter/LetterWizardDialogResources.py:        import imp, os
wizards/com/sun/star/wizards/ui/WizardDialog.py:import imp, os
rene@frodo:~/LibreOffice/git/master$

At least the first two sounds relevant also for LO test usage
Comment 2 Rene Engelhard 2020-04-03 08:56:50 UTC
Just talked about on IRC:

10:14 < _rene_> noelgrandin: an idea which came me just a few mins ago
10:15 < _rene_> noelgrandin: what about making PYTHONWARNINGS=error dependant on --enable-werror?
10:15 <@noelgrandin> _rene_, that sounds reasonable
10:15 < _rene_> it's not compiler but runtime, but still
10:16 < _rene_> and it wouldn't break if some newer python adds some deprecation warnings
10:16  * _rene_ yesterday just removed that line for his packages ;)
10:17 <@noelgrandin> that would catch the problems I care about, so that would be fine
10:19 < _rene_> ok, let me cook up a patch
[...]
10:20 <@noelgrandin> _rene_, thanks
Comment 3 Rene Engelhard 2020-04-03 11:49:02 UTC
https://gerrit.libreoffice.org/c/core/+/91623
Comment 4 Commit Notification 2020-04-03 12:34:36 UTC
Rene Engelhard committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d5a1378d5d78d7bc88ad8754de9dbc174b636944

tdf#131835: don't set PYTHONWARNINGS=error if --enable-werror isn't set

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Rene Engelhard 2020-04-03 12:35:44 UTC
> https://gerrit.libreoffice.org/c/core/+/91623

that has now been pushed.

But still, one should fix those DeprecationWarnings (and maybe also the FutureWarnings) nevertheless.
Comment 6 Rene Engelhard 2020-04-03 13:34:52 UTC
The FutureWarnings I mean are:

13:44 < _rene_> /home/rene/LibreOffice/git/master/instdir/share/Scripts/python/LibreLogo/LibreLogo.py:1946: FutureWarning: Possible nested set at position 14 
                s = re.sub(u"(?u)" + i[0], i[1], s)
13:44 < _rene_> /home/rene/LibreOffice/git/master/instdir/share/Scripts/python/LibreLogo/LibreLogo.py:1946: FutureWarning: Possible nested set at position 28 
                s = re.sub(u"(?u)" + i[0], i[1], s)

(CCing Laszlo)
Comment 7 Rene Engelhard 2020-05-14 15:04:02 UTC
fixed in https://bugs.documentfoundation.org/show_bug.cgi?id=131835, probably (no idea why this bug wasn't mentioned in the commit message although being pointed out...)