On Feb 7, 3:32 pm, "Ville M. Vainio" <[email protected]> wrote:

> And btw, pickleshare has unit tests.. Python pickleshare.py test /tmp/mydb

They fail. For instance, there was no clear method.  Now there is:

def clear (self):
    for z in self.keys():
        self.__delitem__(z)

This method will form the basis of new delete-cache and (maybe) delete-
all-caches commands.

Some changes were needed for Python 3.x to make the tests pass.  For
example keys() replaces iterkeys().

I am doing test-driven development of leo/external/pickleshare.py
using an @test node in leoPy.leo.  I run unit tests externally using
Alt-6. The same node appears in unitTest.leo so that the unit tests
will always be run in future.  Using an @test node is much more
convenient than running an external script: the unit tests naturally
create the testpickleshare directory in .leo/db.

Test-driven development makes possible a step-by-step conversion plan:

1. Get all unit tests to pass when applied to c.cacher using external/
pickleshare.  Done, or almost done.
2. Switch over to the new c.cacher class by setting g.use_cacher =
True. Run all unit tests in unitTests.leo.
3. Remove the code from Leo's core disabled when g.use_cacher is True.
Run all unit tests.
4. (Optional) remove the dependency on external/pickleshare.  That is,
the c.cacher class would use PickleShareDB, PickleShareLink and path
classes defined in leoCache.py. Run all unit tests.
5. (Optional) replace the path class in leoCache.py by calls to
g.os_path_x.  Run all unit tests.

I expect these steps will take awhile, but not too long.

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