PR 3774 completes the 6.7.8 code base

82 views
Skip to first unread message

Edward K. Ream

unread,
Feb 2, 2024, 5:15:08 AMFeb 2
to leo-editor
PR #3774 is now in devel. This PR cleans up Leo's unit tests and fixes a crasher in Leo's new beautifier.

The only remaining issue is #3767: Distribute Leo only on GitHub. The corresponding PR is a work in progress. I'll say more about this issue in another post.

Summary

Please test devel and report any problems immediately.

The only remaining changes for 6.7.8 concern distribution.

I'll alert you when the new distribution model is ready for testing.

Edward

Viktor Ransmayr

unread,
Feb 3, 2024, 6:05:52 AMFeb 3
to leo-editor
Hello Edward,

I tested the latest version of Leo's devel branch inside a Fedora 38 VM

Running the unit tests reveals the following error:

    ======================================================================
    FAIL: test_blank_lines_after_function_3 (unittests.core.test_leoTokens.TestTokenBasedOrange.test_blank_lines_after_function_3)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/user/PyVE/GitHub/Leo/leo-editor/leo/unittests/core/test_leoTokens.py", line 327, in test_blank_lines_after_function_3
        self.assertEqual(results, expected)
    AssertionError: "\\\n[122 chars]omment 1.\n        # Trailing comment 2.\n    print('3')\n" != "\\\n[122 chars]omment 1.\n        # Trailing comment 2.\n        print('3')\n"
      \
          def writeAsisNode(self, p):
              print('1')

              def put(s):
                  print('2')

              # Trailing comment 1.
              # Trailing comment 2.
    -     print('3')
    +         print('3')
    ? ++++


    ----------------------------------------------------------------------
    Ran 931 tests in 7.797s

    FAILED (failures=1, skipped=5)
    (Leo) [user@fedora-leo-study-vm leo]$


With kind regards,

Viktor
 

Thomas Passin

unread,
Feb 3, 2024, 10:00:57 AMFeb 3
to leo-editor
On Windows 10, Python 3.12 -

============================ warnings summary ============================
leo\plugins\leo_babel\tests\lib_test.py:118
  C:\Tom\git\leo-editor\leo\plugins\leo_babel\tests\lib_test.py:118: PytestCollectionWarning: cannot collect test class 'TestCmdr' because it has a __init__ constructor (from: leo/plugins/leo_babel/tests/lib_test.py)
    class TestCmdr:

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=============== 929 passed, 2 skipped, 1 warning in 22.81s ===============


Leo 6.7.8-devel, devel branch, build fb38e0c603
2024-02-01 17:16:21 -0600
Python 3.12.0, PyQt version 5.15.2
Windows 10 AMD64 (build 10.0.19045) SP0

Thomas Passin

unread,
Feb 3, 2024, 12:04:30 PMFeb 3
to leo-editor
Got some errors on XUbuntu/Python 3.11:

=================================== FAILURES ===================================
____________ TestTokenBasedOrange.test_blank_lines_after_function_3 ____________

self = <leo.unittests.core.test_leoTokens.TestTokenBasedOrange testMethod=test_blank_lines_after_function_3>

    def test_blank_lines_after_function_3(self):
   
        # From leoAtFile.py.
        contents = r"""\

    def writeAsisNode(self, p):
        print('1')
   
        def put(s):
            print('2')
   
        # Trailing comment 1.
        # Trailing comment 2.
        print('3')
    """
        contents, tokens = self.make_data(contents)
        expected = contents
        results = self.beautify(contents, tokens)
>       self.assertEqual(results, expected)
E       AssertionError: "\\\n[122 chars]omment 1.\n        # Trailing comment 2.\n    print('3')\n" != "\\\n[122 chars]omment 1.\n        # Trailing comment 2.\n        print('3')\n"
E         \
E             def writeAsisNode(self, p):
E                 print('1')
E        
E                 def put(s):
E                     print('2')
E        
E                 # Trailing comment 1.
E                 # Trailing comment 2.
E       -     print('3')
E       +         print('3')
E       ? ++++

leo/unittests/core/test_leoTokens.py:327: AssertionError
=============================== warnings summary ===============================
leo/plugins/leo_babel/tests/lib_test.py:118
  /home/tom/git/leo-editor/leo/plugins/leo_babel/tests/lib_test.py:118: PytestCollectionWarning: cannot collect test class 'TestCmdr' because it has a __init__ constructor (from: leo/plugins/leo_babel/tests/lib_test.py)
=========================== short test summary info ============================
FAILED leo/unittests/core/test_leoTokens.py::TestTokenBasedOrange::test_blank_lines_after_function_3 - AssertionError: "\\\n[122 chars]omment 1.\n        # Trailing comment 2.\n ...
============= 1 failed, 904 passed, 26 skipped, 1 warning in 9.32s ============


Edward K. Ream

unread,
Feb 4, 2024, 3:33:53 AMFeb 4
to leo-e...@googlegroups.com
On Sat, Feb 3, 2024 at 11:04 AM Thomas Passin <tbp1...@gmail.com> wrote:
Got some errors on XUbuntu/Python 3.11:

Thanks for your testing:  See #3777.

Edward

Edward K. Ream

unread,
Feb 4, 2024, 3:35:22 AMFeb 4
to leo-e...@googlegroups.com
On Sat, Feb 3, 2024 at 5:05 AM Viktor Ransmayr wrote:

> Running the unit tests reveals the following error:

Thanks for your testing. See #3777.

Edward

Edward K. Ream

unread,
Feb 4, 2024, 3:38:37 AMFeb 4
to leo-e...@googlegroups.com
On Sat, Feb 3, 2024 at 9:01 AM Thomas Passin wrote:
On Windows 10, Python 3.12 -
leo\plugins\leo_babel\tests\lib_test.py:118
  C:\Tom\git\leo-editor\leo\plugins\leo_babel\tests\lib_test.py:118: PytestCollectionWarning:
cannot collect test class 'TestCmdr' because it has a __init__ constructor
(from: leo/plugins/leo_babel/tests/lib_test.py)
...

Thanks for this report. See #3778.

Edward

Thomas Passin

unread,
Feb 4, 2024, 2:41:44 PMFeb 4
to leo-editor
For the recent merge in devel, 08fcbac60bc296b2e636c3467daf29022b03231b, there is still a warning from XUbuntu:

=============================== warnings summary ===============================
leo/plugins/leo_babel/tests/lib_test.py:118
  /home/tom/git/leo-editor/leo/plugins/leo_babel/tests/lib_test.py:118: PytestCollectionWarning: cannot collect test class 'TestCmdr' because it has a __init__ constructor (from: leo/plugins/leo_babel/tests/lib_test.py)
================== 905 passed, 26 skipped, 1 warning in 8.84s ==================

There is a similar warning on Windows 10:

============================ warnings summary ============================

leo\plugins\leo_babel\tests\lib_test.py:118
  C:\Tom\git\leo-editor\leo\plugins\leo_babel\tests\lib_test.py:118: PytestCollectionWarning: cannot collect test class 'TestCmdr' because it has a __init__ constructor (from: leo/plugins/leo_babel/tests/lib_test.py)
=============== 929 passed, 2 skipped, 1 warning in 21.87s ===============

Interesting how much faster the tests run in Linux than Windows.

Thomas Passin

unread,
Feb 4, 2024, 2:45:57 PMFeb 4
to leo-editor
On Linux/Manjaro there is the same warning, but it only skipped 3 tests instead of 26.  It too a few seconds longer than on XUbuntu.

Edward K. Ream

unread,
Feb 4, 2024, 6:21:18 PMFeb 4
to leo-editor
On Saturday, February 3, 2024 at 9:00:57 AM UTC-6 Thomas wrote:
On Windows 10, Python 3.12 -

============================ warnings summary ============================
leo\plugins\leo_babel\tests\lib_test.py:118
  C:\Tom\git\leo-editor\leo\plugins\leo_babel\tests\lib_test.py:118: PytestCollectionWarning: cannot collect test class 'TestCmdr' ...

leo\plugins\leo_babel\tests\lib_test.py appears to be a bespoke unit testing framework.

I have no intention of diving into those weeds, so I'm going to close #3778.

To run Leo's unit tests with pytest do pytest leo\unittests, not pytest leo.

Edward

Thomas Passin

unread,
Feb 5, 2024, 1:09:34 PMFeb 5
to leo-editor
OK, doing it that way on XUbuntu gave no errors but many more skipped tests than on Windows (Windows skipped two importer tests):

905 passed, 26 skipped in 8.59s

Thomas Passin

unread,
Feb 5, 2024, 1:16:42 PMFeb 5
to leo-editor
On my Manjaro VM only three were skipped - one importer, one speller, one in leoAst.

928 passed, 3 skipped in 11.53s

I wonder if something isn't installed on the XUBuntu VM, like a language or something else outside of Leo itself.

Edward K. Ream

unread,
Feb 5, 2024, 7:52:58 PMFeb 5
to leo-e...@googlegroups.com
On Mon, Feb 5, 2024 at 12:09 PM Thomas Passin <tbp1...@gmail.com> wrote:
OK, doing it that way on XUbuntu gave no errors but many more skipped tests than on Windows (Windows skipped two importer tests):

905 passed, 26 skipped in 8.59s

Thanks for your testing.

The skipped tests reveal missing modules. To see the requirements, do a cff on "skipTest".  Heh, I see there are several tests for Python 3.8 and lower.

Leo 6.7.8 will use compute requirements using pip freeze > requirements.txt. Doing so should ensure fewer skipped tests. See the checklist in PR #3775.

Edward
Reply all
Reply to author
Forward
0 new messages