*tl;dr:* Important core classes, including importer classes, could support
a reload method, that would reload the file containing the class, *and *return
a new instance of the class, ready to be used by unit tests.
This is an experimental idea. It won't revolutionize Leo's unit tests, but
it might make them lighter and stronger.
*Details*
At present, Leo's unit tests support TDD using preamble code, like this:
if 0: # Preamble...
g.cls()
if c.isChanged(): c.save()
import leo.core.leoImport as leoImport
import leo.plugins.importers.linescanner as linescanner
import leo.plugins.importers.markdown
import leo.plugins.writers.markdown
import imp
imp.reload(leo.plugins.importers.linescanner)
imp.reload(leo.plugins.importers.markdown)
imp.reload(leo.plugins.writers.markdown)
imp.reload(leoImport)
ic = leoImport.LeoImportCommands(c)
else:
ic = c.importCommands
Cutting, pasting and modifying this template has been good enough, but we
would like something better, maybe:
if 0: # Preamble...
g.cls()
if c.isChanged(): c.save()
ic.linescanner.reload()
ic.importers.markdown.reload()
ic.writers.markdown.reload()
ic = c.importCommands.reload()
else:
ic = c.importCommands
To make this work, the importCommands class would have to have ivars for
all readers & writers, or a __getattr__ method. It's worth looking into.
EKR
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.