[liblouis-liblouisxml] Re: Python3: Liblouis Python tests doesn't work

  • From: Michael Whapples <mwhapples@xxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Mon, 14 May 2012 10:55:25 +0100

Hello,
My short answer at the moment is, I haven't done any work to get the tests to work with python3 bindings at the moment, they are expected to not work.

However this raises questions, as potentially people may have the python2 and python3 bindings built, the test system probably needs to be able to test both sets with the relevant python version.

Michael Whapples
On 14/05/2012 07:29, Hammer Attila wrote:
Hy,

Very sorry, my letter will be longer.
Following Liblouis tests failed if I using Python3:
FAIL: check_doctests.py
FAIL: runHarness.py

Both two scripts producing following sintax errors:
1. In tests/check_doctests.py file:
Traceback (most recent call last):
  File "./check_doctests.py", line 5, in <module>
    import louis
  File "/usr/src/liblouis/liblouis/python/louis/__init__.py", line 291
    print version()
                ^
SyntaxError: invalid syntax
This error happening only hopefuly because my system now Python3 the default interpreter, but when the test want running, imported in the ../python/louis/__init__.py file with compatible the Python 2.7 version, not the python3 bindings in the ../python3/louis/__init__.py file.

2. In runharness.py file:
File "./runHarness.py", line 76
    print "\n".join(report).encode("utf-8")
             ^
SyntaxError: invalid syntax

If I manual owerwrite the ../python/liblouis/__init__.py file the Python3 compatible file and doing the automatic Python 2to3 migration in the runHarness.py file, I get interesting test results. I attaching the automatic generated 2to3 tool doed patch and the test results to you see what txt based doctests are failed if the default Python interpreter is 3.2.

The test result file absolute clear seeing a little need work:
with Need doing future in the test harness files to prowide compatibility with Python3, because with committed test harness files doesn't running in Python3. Following files need doing modifications, with I already doed if future entire need migrating Python3, sending with attachment: tests/harness/en-GB-g2_harness.py, tests/harness/hu1_harness.py, tests/harness/letterDefTest_harness.py Unfortunately this modifications not provide compatibility with Python 2.7 version, because Python3 already handles strings I think with unicode format, but Python 2.7 is not. Now, in very early Ubuntu 12.10 development release the default Python interpreter is 2.7.3, but Joanie wrote this is will be change.

Attila

For a description of the software, to download it and links to
project pages go to http://www.abilitiessoft.com

Other related posts: