Failing unittest in devel branch

61 views
Skip to first unread message

Viktor Ransmayr

unread,
Dec 28, 2022, 5:15:32 AM12/28/22
to leo-editor
Hello Edward,

When I run the unit tests for the latest version of the devel branch, I receive the following error:

###

    ======================================================================
    ERROR: test_cursesGui2 (leo.unittests.test_plugins.TestPlugins)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/unittests/test_plugins.py", line 114, in test_cursesGui2
        import leo.plugins.cursesGui2 as cursesGui2
      File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/plugins/cursesGui2.py", line 50, in <module>
        from tkinter import Tk
    ModuleNotFoundError: No module named 'tkinter'

    ----------------------------------------------------------------------
    Ran 941 tests in 7.309s

    FAILED (errors=1, skipped=3)
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$

###

This happens in a Debian 11 - as well as - a Fedora 36 VM.

With kind regards,

Viktor

Thomas Passin

unread,
Dec 28, 2022, 10:16:37 AM12/28/22
to leo-editor
You have to install it using the package manager.  Here is what I have found (quoted from the Users' Guide for my GF4 project)::

"On Debian/Ubuntu, tkinter has to be installed by
the package manager:

    sudo apt-get install python3-tk

This may also be the case with some non-Debian systems.
The package manager command will be different.  For the Yum package manager
(you might have to use sudo, su root, or its equivalent to get administrative
permissions):

    yum install tkinter

You may also need to install ImageTk.  On Debian-based systems:

    sudo apt-get install python3-pil.imagetk

On CentOS/RHEL, the PIL-related packages to install with the package manager
are (*pillow* has replaced the older *PIL* imaging library):

    python3-pillow
    python3-pillow-tk"

But if it's the curses gui, why does it need tkinter?  That seems strange.

Viktor Ransmayr

unread,
Dec 28, 2022, 1:30:10 PM12/28/22
to leo-editor
Hello Thomas,

Thanks for this explanation / info.

tbp1...@gmail.com schrieb am Mittwoch, 28. Dezember 2022 um 16:16:37 UTC+1:
You have to install it using the package manager.  Here is what I have found (quoted from the Users' Guide for my GF4 project)::

"On Debian/Ubuntu, tkinter has to be installed by
the package manager:

    sudo apt-get install python3-tk

I also double-checked & saw that 'setup.py' has added "tk" as an install requirement.

As I initially only did a 'git pull' on Leo's devel branch - and - did NOT perform a subsequent 'pip install --editable /home/user/PyVE/GitHub/Leo/leo-editor' I re-tried running the unit tests afterwards & the same failure occurred ...

Who is to 'blame' for treating Linux as a second-class citizen?

Leo's 'setup.py' script - or - the Python Packagers of Debian & Fedora Linux ...

With kind regards,

Viktor

Viktor Ransmayr

unread,
Dec 28, 2022, 1:38:11 PM12/28/22
to leo-editor
Hello Edward & Thomas,

As an additional info Leo's unit tests are working fine in version 6.7.1 on both Debian- & Fedora Linux.

With kind regards,

Viktor

Thomas Passin

unread,
Dec 28, 2022, 1:41:11 PM12/28/22
to leo-editor
There's no "blame" here, just a need to work around how the Linux packagers have decided to work.  I *think* they want to split up and locate python components in particular ways to suit their packaging philosophies, so they have to modify pip, etc., to work that way.

It is possible to install Python on Linux using Linux installers /tarballs from python.org.  These do come with (I think) pip and tk, but they won't be managed by the Linux update system, which utility, etc., and they may not install into the locations favored by the distro people.

Thomas Passin

unread,
Dec 28, 2022, 1:47:10 PM12/28/22
to leo-editor
" I also double-checked & saw that 'setup.py' has added "tk" as an install requirement."

I wonder if Leo needs tk at all any more.  Maybe it can be removed as a requirement.

On Wednesday, December 28, 2022 at 1:30:10 PM UTC-5 viktor....@gmail.com wrote:

Viktor Ransmayr

unread,
Dec 28, 2022, 2:23:07 PM12/28/22
to leo-editor
Hello Thomas,

tbp1...@gmail.com schrieb am Mittwoch, 28. Dezember 2022 um 19:47:10 UTC+1:
" I also double-checked & saw that 'setup.py' has added "tk" as an install requirement."

I wonder if Leo needs tk at all any more.  Maybe it can be removed as a requirement.

Here's the complete output from my second attempt to run unit tests on Debian:

     (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo$ cd leo-editor/
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$ python -m unittest
    ................................................................................
    ................................................................................
    ................................................................................
    ...s............................................................................
    ........................................................s.......................
    ................................................................................
    ................................................................................
    ................................................................................
    ................................................................................
    ................................s...............................................
    ................................................................................
    ...................................................cursesGui2.py: Tk module required for clipboard handling.
    E.........

    ======================================================================
    ERROR: test_cursesGui2 (leo.unittests.test_plugins.TestPlugins)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/unittests/test_plugins.py", line 114, in test_cursesGui2
        import leo.plugins.cursesGui2 as cursesGui2
      File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/plugins/cursesGui2.py", line 50, in <module>
        from tkinter import Tk
    ModuleNotFoundError: No module named 'tkinter'

    ----------------------------------------------------------------------
    Ran 941 tests in 7.338s

    FAILED (errors=1, skipped=3)
    (Leo) user@debian-leo-study-vm:~/PyVE/GitHub/Leo/leo-editor$

If I read the info correctly, than at least the cursesGui2 plugin - and/or - the unit tests for it, still require the 'tkinter' module ...

Let's wait & see what Edward thinks.

With kind regards,

Viktor

Thomas Passin

unread,
Dec 28, 2022, 3:59:49 PM12/28/22
to leo-editor
I doubt that it's actually "required" in the sense that tk is used any more.  If a test calls for it, probably that test should be updated.

Edward K. Ream

unread,
Dec 29, 2022, 11:23:04 AM12/29/22
to leo-e...@googlegroups.com
On Wed, Dec 28, 2022 at 4:15 AM Viktor Ransmayr <viktor....@gmail.com> wrote:
When I run the unit tests for the latest version of the devel branch, I receive the following error:
...

    ERROR: test_cursesGui2 (leo.unittests.test_plugins.TestPlugins)

Thanks for this report. I have just created #3017 for this. The test should be skipped if _curses does not exist.

Edward
Reply all
Reply to author
Forward
0 new messages