[node-devel] Running doctests on Node and improving them

Mike Burns mburns at redhat.com
Thu Jul 5 15:58:33 UTC 2012


On Thu, 2012-07-05 at 17:46 +0200, Fabian Deutsch wrote:
> Hey,
> 
> some of our "backing libraries" like ovirtfunctions.py contain doctests.
> Those are small for documenting the usage of the function but can also
> be used for testing [1].
> As pointed out on the wiki [2] thos tests can't be run at dev. time,
> because they partially rely on runtime functionality.
> 
> Just a minute ago I tested to run the doctest on ovirtfunctions.py on a
> running node:
> 1. Installed a node
> 2. Dropped to console
> 3. ran::
>   cd /usr/lib/python2.7/site-packages/ovirtnode
>   python -m doctest ovirtfunctions.py
> 
> This failed, but is actually expected - as no work has gone into
> enabling this feature.
> 
> There are two things we should do:
> 1. Fix the error that prevented running the doctest (smome indentation 
>    problem!?)

Please file a bz (and provide a patch ;-) )

> 2. Add doctests to python functions to cover more functions

Please file bz's with "RFE: " in the summary for this.  This is a longer
term goal
> 
> doctests are a fine granular piece in our CI testing effort - but are
> easy to create.
> One question is if we should also add real unit tests covering wider
> parts?
> I'd rather go with higher-level testcases (e.g. TUI tests [3]), which
> should cover the core functionality.

Agreed that we should lean more toward the testcases to cover our
testing, but having unit tests is absolutely useful as well.  I'd stick
to simple unit tests with doctest and have a higher level test case that
will run the doctest stuff as well.

Mike

> 
> That was an update on how to run doctests - but don't hesitate to join
> in to make Node more stable.
> 
> Greetings
> fabian
> 
> --
> [1] http://docs.python.org/library/doctest.html
> [2] http://ovirt.org/wiki/Node_Testing
> [3] http://gerrit.ovirt.org/gitweb?p=ovirt-node-tests.git;a=blob;
> f=docs/Writing_TUI_Tests.rst;hb=HEAD
> _______________________________________________
> node-devel mailing list
> node-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/node-devel





More information about the node-devel mailing list