[TIP] New! Writing doctests for Trac plugins WAS: [Trac] Re: Writing tests for Trac plugins : How ?

Olemis Lang olemis at gmail.com
Mon Dec 28 11:44:54 PST 2009


On Tue, Jul 21, 2009 at 12:51 AM, Chris Heller
<chris.heller.greysparling at gmail.com> wrote:
>
> There are numerous plugins on trac-hacks that have unittest based
> tests.

Thanks all for your suggestions and comments.

I have been preparing the next release (coming soon ;o) of TracGviz
1.4.1 and I've been (finally) able to publish the repos [1]_
containing most of the work been done so far. In there (`providers`
branch) you can find the doctests I've written to test Trac RPC
handlers. All this has been implemented on top of `dutest` module and
is the first instance (that I know ... CMIIW) of both a dutest-based
framework for particular purposes thus hiding details about
initialization and cleanup , and a framework to write doctests for
Trac plugins.

All tests pass using TracXmlRpc=1.0.0 and failures with
TracXmlRpc=1.0.6 have only been detected in ReportRPC (/me working on
it :-/ )

> Here are some handy starting points for exploration.
>
[...]

«Starting points for exploration» are here [2]_ [3]_ ;o)

Needless to say that there's a lot of place for enhancements in there
(especially tests for multi-protocol RPC, for repositories, and
in-process web testing ...) but at least you can get the idea of the
style and so on . Once I write further test cases they will show up
;o)

Feedback is welcome !

PS: C'u soon with a new release of TracGViz plugin ... Happy New Year !

o<|:o)

.. [1] TracGViz Hg @ sf.net
        (http://simelo.hg.sourceforge.net/hgweb/simelo/trac-gviz/summary)

.. [2] Test cases (i.e. doctests) for RPC providers in TracGViz plugin
        (http://simelo.hg.sourceforge.net/hgweb/simelo/trac-gviz/file/providers/trac-dev/gviz/tracgviz/testing/test_rpc.py)

.. [3] Minimalistic testing framework for Trac
        (http://simelo.hg.sourceforge.net/hgweb/simelo/trac-gviz/file/providers/trac-dev/gviz/tracgviz/testing/__init__.py)

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:
Assessment of unittest 2.7 API : new features and opinions  -
http://feedproxy.google.com/~r/simelo-en/~3/cVOgG8NIBFY/assessment-of-unittest-27-api-new.html



More information about the testing-in-python mailing list