Yesterday's Engineering Notebook post was full of details. Today's report will be shorter and less technical.
Work has reached a big milestone. All the new unit tests for leo/commands/editCommands.py now pass. The key was creating a parent node to hold Leo directives. Many commands depend on @pagewidth and @tabwidth directives, so the testing framework must provide a place for them.
Other tests failed because of ludicrous testing hacks in the commands themselves, which individual (new style) tests now work around in various ways. For now, and probably "forever", I'll leave Leo's core as it is so that unitTest.leo will continue to work.
Considerable work remains
1. At present, the unit tests only verify that the various commands change the body text as expected. Tests that the selection range changes as expected fail. This should be straightforward to fix. Similarly, the undo/redo tests should be re-enabled.
2. The new-style tests don't need the "workNode" node. This node is useful when using unitTest.leo, but not in the new testing world.
3. I shall soon create a leo/unittest directory to hold separate testing files. I now see that I don't want to "pollute" Leo's sources with test code:
- Using separate test files is the usual practice.
- The test code adds unnecessary length to the coverage reports and skews coverage statistics.
Important:
I don't want to put test files in the existing leo/test directory. That directory has lots of cruft that would complicate test discovery. leo/test will stay exactly as it is.
Summary
All the new unit tests for leo/commands/editCommands.py now pass.
Several more days of work remain.
My focus remains on the sabbatical. However, it would be
unbearable to leave the new unit testing work unfinished. Yes, this "interrupts" the sabbatical, but I can see no practical psychological alternative.
Leaving leoTest.py unchanged has been the correct decision. I'll deprecate unitTest.leo, but unitTest.leo, and all its support code in leoTest.py, will remain "forever".
Edward