On Nov 4, 3:29 pm, "Edward K. Ream" <[email protected]> wrote:

> > I have been looking closely for any more sand--I don't know of any.

Just found another bit of grit:  there is little or no machinery to
set up config settings in external unit tests.

**Important**: This is far from a gotcha:  I'm still in love with
Alt-4 :-)

As a workaround, the unit test that I have been working on all day
today (the test that demonstrates the html whitespace problem) does
the following::

    # When run externally, c.config.getData will return None.
    html_tags = ('body','head','html','table','xxx',)
    setting = 'import_html_tags'
    existing_tags = c.config.getData(setting)
    if not existing_tags:
        g.app.config.set(None,setting,'data',html_tags)
        g.app.config.set(None,'full_import_checks','bool',True)

But this is not satisfactory.

Calling g.app.config.set isn't hard: the problem is realizing that the
test does have to set particular settings!

I certainly had no memory of the @bool full_import_checks setting.  So
I had to figure out why the external unit test was always passing,
when the local test failed as expected.

Yes, one could define a default setting for full_import_checks, so
that external unit tests will use them, but that only works for
*today's* unit test.  It's not a general solution.

Furthermore, it's not obvious what to use for settings in external
unit tests.  We can use the existing settings in unitTest.leo, because
we have an @settings node there that can define settings for unit
tests.  But outside of unitTest.leo the @settings node isn't going to
be tailored for unit testing!

As I write this, I see that the code that creates dynamicUnitTest.leo
should probably copy the @settings tree from unitTest.leo, plus all
the settings in leoSettings.leo.  Yuck.  Fully initing settings might
slow down external tests a lot, and that would not be good.

For now, I'll live with this problem, but I think it will have to be
fixed eventually...

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