On Wednesday, December 2, 2020 at 5:55:52 AM UTC-6 Edward K. Ream wrote:
> I'll deprecate unitTest.leo, but unitTest.leo, and all its support code
in leoTest.py, will remain "forever".
When I first announced this project, someone commented that using
unitTest.leo doesn't preclude coverage testing. I dismissed the comment at
the time, but it's been stewing in the back of my mind.
Yesterday was a long and tiring day. Just after all the tests started to
work I started to wonder whether the whole idea wasn't just a foolish
sideshow. I know enough not to give much weight to such exhausted thoughts,
but the question is worth a second look.
My verdict: The comment is "technically" correct. The present (hairy) code
in leoTest.py could run pytest-cov rather than unittest. But there are
overwhelming reasons to migrate away from unitTest.leo:
1. The new testing scheme is standard. There is much less for new Leo devs
to learn.
2. The new testing scheme is *much* simpler than the old. leoTest.py is a
horror show. leoTest2.py is straightforward.
3. It is *far* easier to run the new unit tests from within Leo with
@command run-test @key=ctrl-4:
g.cls()
import importlib
import leo.core.leoTest2 as leoTest2
importlib.reload(leoTest2)
import os
args = '' # '-v'
module = '-m leo.commands.editCommands'
test = '' # '-k "test_rectangle_yank"'
output_file = '' # r'> C:\Users\edreamleo\Desktop\trace.txt'
command = f"python {args} {module} {test} {output_file}"
print(command)
os.system(command)
This is much easier than re-launching unitTest.leo! And it's easy to run
similar commands from the command line.
And it's faster. Yes, create_app takes 1 second to create a mock Leo app,
but launching unitTest.leo takes a lot longer!
Edward
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/cb56a85e-1940-4024-b5a0-7b99a4232429n%40googlegroups.com.