On Tuesday, December 6, 2016 at 6:03:49 PM UTC-6, Edward K. Ream wrote:

Cutting, pasting and modifying [preamble code] has been good enough, but we 
> would like something better, maybe:
>
> if 0: # Preamble...
>     g.cls()
>     if c.isChanged(): c.save()
>     ic.importers.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.
>

Hmm. This might be simplified to:

if 0: # Preamble...
    g.cls()
    if c.isChanged(): c.save()
    ic = c.importCommands.reload()
else:
    ic = c.importCommands

The call to c.importCommands.reload() could return a new GeneralTestCase 
instance and this instance could set a reload flag.  The later call to 
ic.markdownUnitTest(p...) would then reload markdown and linescanner when 
the reload flag is set.

But... leoTest.leo defines several other subclasses of unittest.TestCase 
besides GeneralTestCase.  So maybe we need variants of 
c.importCommands.reload to handle the other kinds of TestCase.

I'm not in a hurry to do any of this, since the present importer cases 
work.  Still it's a good idea to keep these ideas in the back of our minds. 
This kind of simplification could be useful when creating other kinds of 
unit tests.

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.

Reply via email to