On Mon, Nov 12, 2012 at 9:13 AM, Edward K. Ream <[email protected]> wrote:
> The following Leo script, run from statictypechecking.leo, will run
> all files in the "test" directory::

There is an important detail that must be handled: we must completely
kill the old version of the unit test module.  This can be done as
follows::

    if module_fn in sys.modules:
        del(sys.modules[module_fn])

The reason is subtle:  imp.load_module is equivalent to imp.reload if
the module already exists, but imp.reload does *not* clear out
previous values in the module.  This will cause problems if, say, you
change the name of a test class.  Without the statement above, the
unittest module will see all the previous test class, and run the
tests twice!

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