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

Fabian Deutsch fabiand at redhat.com
Thu Jul 5 15:46:11 UTC 2012


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!?)
2. Add doctests to python functions to cover more functions

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.

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ovirt.org/pipermail/node-devel/attachments/20120705/a2a8b13e/attachment.sig>


More information about the node-devel mailing list