On Nov 7, 12:33 pm, "Edward K. Ream" <[email protected]> wrote:

> > On Mon, Nov 7, 2011 at 12:19 PM, Terry Brown <[email protected]> 
> > wrote:

> > So you doubled the startup time?

Oh joy.  I just realized that *another* change in the avalanche
removes the need to read leoSettings.leo.  Thus, the question of
whether 0.35 sec is "significant" or not becomes moot.  (But see the
last two paragraphs.)

Thanks for your question!  Without it, I might not have realized that
this simplification was possible.

Here is the unit test that I am using to test the html-import bug:

QQQQQ
    fn = r'c:\recent\data.html'

    # Fails with more tags: a newline gets inserted between tags.
    html_tags = ('body','head','html','table','xxx',)
    setting = 'import_html_tags'

    c.config.set(setting,'data',html_tags)
    tags = c.config.getData(setting)
    assert tags == html_tags,len(tags)

    c.importCommands.importFilesCommand(files=[fn],treeType='@file')

    fail = g.app.unitTestDict.get('fail')
    assert not fail
QQQQQ

The call to c.config.set is a recent part of the avalanche.
Previously, one had to call g.app.config.set, but bugs rendered it
useless.  Now, as shown, a unit test can "jam" any settings it pleases
into Leo's config system, and the *code being tested* will use the
"jammed" settings.

This is the simplest thing that could possibly work, and moreover, it
puts responsibility for settings where it belongs, namely in the unit
test code.

Alas, there is a potentially large glitch remaining:  unit test code
must ensure that all required settings are either set in the unit test
code, or are set automatically in Leo's core when g.app.unitTesting is
True.  As discussed yesterday, it's no great hardship to add special-
case code when unit testing, but this issue does have the potential to
cause unexpected failures of unit tests.  The surprises due to
forgotten-yet-important settings may be rare, but they will waste a
lot of time while the unexpected failures are tracked down.

In short, there remains a nagging doubt about whether or not it is
wise to skip the init of settings to defaults in leoSettings.leo
during unit testing.  For now, I'm willing to "save" the 0.35 sec on
each Alt-4., with the understanding that it might cost me quite a bit
more than 0.35 sec later...

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.

Reply via email to