Please test PR #3398 in the ekr-fix-test branch

63 views
Skip to first unread message

Edward K. Ream

unread,
Jun 19, 2023, 6:33:32 AM6/19/23
to leo-editor
Thanks to those who have tested the recent code.

PR #3398 contains my proposed fixes for several failing unit tests.

I have tested this with various versions of python on both Windows and Ubuntu.

Please check out the ekr-fix-test branch and report any further problems.  Thanks.

Edward

Thomas Passin

unread,
Jun 19, 2023, 7:50:17 AM6/19/23
to leo-editor
On Windows 10, py -3.xx pytest:

python 3.11:
leo\unittests\test_importers.py ...s............................... [  5%]
============================ 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
=============== 852 passed, 1 skipped, 1 warning in 15.03s ===============

Python 3.10:
leo\unittests\test_importers.py ...s............................... [  5%]
leo\unittests\core\test_leoAst.py ..............................s.. [ 40%]
============================ 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
=============== 851 passed, 2 skipped, 1 warning in 13.50s ===============


Python 3.9:
leo\unittests\test_importers.py ...s............................... [  5%]
leo\unittests\core\test_leoAst.py ......................s.......s.. [ 40%]
============================ 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
=============== 850 passed, 3 skipped, 1 warning in 20.97s ===============


Interesting how 3.10 is faster than 3.9 and 3.11.

Thomas Passin

unread,
Jun 19, 2023, 8:21:24 AM6/19/23
to leo-editor
Various Linuces:

3.11 Manjaro:
leo\unittests\test_importers.py ...s............................... [  5%]
==================================== 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)
======================= 852 passed, 1 skipped, 1 warning in 8.38s ========================

3.9 Mint (Note that pyqt6 is not installed on this VM/Python3.9):
leo/unittests/test_importers.py ...s.................................... [  6%]
leo/unittests/core/test_leoAst.py ......................s.......s....... [ 40%]
leo/unittests/core/test_leoQt6.py s                                      [ 92%]
=============================== 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)
================== 849 passed, 4 skipped, 1 warning in 9.46s ===================

3.10 Ubuntu:
leo/unittests/test_importers.py ...s.................................... [  6%]
leo/unittests/core/test_leoAst.py ..............................s....... [ 40%]
=============================== 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)
================== 851 passed, 2 skipped, 1 warning in 10.32s ==================

Interesting how much faster these tests run on the various Linuces compared with Windows.

Edward K. Ream

unread,
Jun 19, 2023, 8:58:17 AM6/19/23
to leo-e...@googlegroups.com


On Mon, Jun 19, 2023 at 7:21 AM Thomas Passin <tbp1...@gmail.com> wrote:

Thanks for your tests. I'm not worried about warnings.

Edward

Félix

unread,
Jun 19, 2023, 8:54:43 PM6/19/23
to leo-editor
on my old windows laptop, with python 3.9.6, i still get one failed test. Screenshot below:
still-single-unit-test-fail-python396.png

Félix

unread,
Jun 19, 2023, 11:05:45 PM6/19/23
to leo-editor
and on ubuntu with python 3.10 i also get that test_tryStar one, along with the test_recursive_import one that checks for an absolute path starting with "C:\" on linux systems (wich fails.)

Since the minimize_headline contains this line: 
os.path.isabs(self.root_directory)
should the unittest check to give a path that is particular for windows/vs/posix file paths? 

e.g.: (from test_g_finalize and test_g_finalize_join, in test_leoGlobals.py) 
expected_leo_base = 'C:/leo_base' if g.isWindows else '/leo_base'

(i'll investigate for the tryStar test fail in test_leoAst also soon)

======================================================================
FAIL: test_TryStar (leo.unittests.core.test_leoAst.TestTOG)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/felix/leo-editor/leo/unittests/core/test_leoAst.py", line 1138, in test_TryStar
    self.make_data(contents)
  File "/home/felix/leo-editor/leo/unittests/core/test_leoAst.py", line 181, in make_data
    self.fail('make_tree failed')  # pragma: no cover
AssertionError: make_tree failed

======================================================================
FAIL: test_recursive_import (leo.unittests.core.test_leoImport.TestLeoImport)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/felix/leo-editor/leo/unittests/core/test_leoImport.py", line 105, in test_recursive_import
    x.minimize_headline(root)
  File "/home/felix/leo-editor/leo/core/leoImport.py", line 1785, in minimize_headline
    assert os.path.isabs(self.root_directory)
AssertionError

----------------------------------------------------------------------
Ran 853 tests in 9.405s

FAILED (failures=2, skipped=18)

Félix

unread,
Jun 19, 2023, 11:30:30 PM6/19/23
to leo-editor
about the tryStar test fail: 
I've stepped in the test running in a debugger, and in leoAst, the ast.parse call fails (when stepping into it brings us into usr/lib/python3.10/ast.py's parse function) and it throws an error in it's call to 'compile' function.:
    return compile(source, filename, mode, flags,
                   _feature_version=feature_version)


Can't step into that since it's a native python lib. Anyways, it doesnt like the "*" asterisks of the test_TryStar contents, which i've checked to be somewhat ok while stepping in the code: 
try:
print('a1')
print('a2')
except* ImportError:
print('b1')
print('b2')
except* SyntaxError:
print('c1')
print('c2')
else:
print('d1')
finally:
print('e1')
print('e2')

I dont know much about this 'ast' business, :)  so i dont really know what to check for... 

anyways, no biggie,  let me know if there's any specific thing you'd like me to try out to help fix those tests :)

Félix

Edward K. Ream

unread,
Jun 20, 2023, 7:14:39 AM6/20/23
to leo-e...@googlegroups.com
On Mon, Jun 19, 2023 at 7:54 PM Félix <felix...@gmail.com> wrote:
on my old windows laptop, with python 3.9.6, i still get one failed test. Screenshot below:

Are you running this test in the ekr-fix-test branch?  The lines:

 if py_version < (3, 11):
        self.skipTest('Python 3.11+ only')

should skip the test.

Eward

Edward K. Ream

unread,
Jun 20, 2023, 7:24:33 AM6/20/23
to leo-e...@googlegroups.com
On Mon, Jun 19, 2023 at 10:30 PM Félix <felix...@gmail.com> wrote:
about the tryStar test fail: 
I've stepped in the test running in a debugger

This should not be necessary.  The only thing to check is whether the call to skipTest is executed :-)

Edward

Robert-Felix

unread,
Jun 20, 2023, 9:24:27 AM6/20/23
to leo-e...@googlegroups.com
Oops, looks like i can't read! Sorry about that!

--
You received this message because you are subscribed to the Google Groups "leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/CAMF8tS0UQV414TtJD9CbiJpRyWzv2puSX7wvXD0ch6R%3DsQxrfg%40mail.gmail.com.

Edward K. Ream

unread,
Jun 20, 2023, 9:51:57 AM6/20/23
to leo-e...@googlegroups.com
On Tue, Jun 20, 2023 at 8:24 AM Robert-Felix <felix...@gmail.com> wrote:
Oops, looks like i can't read! Sorry about that!

So you didn't run the tests in the ekr-fix-test branch?

Edward

Félix

unread,
Jun 22, 2023, 12:30:17 AM6/22/23
to leo-editor
i finally got around to do so after realizing i was still testing on devel and not on ekr-fix-branch lol ! :)
Reply all
Reply to author
Forward
0 new messages