[TIP] Plugin API for nose: Expanding one test case into many

Kumar McMillan kumar.mcmillan at gmail.com
Sat Jul 19 10:03:03 PDT 2008


On Fri, Jul 18, 2008 at 8:07 PM, Ben Finney <ben+python at benfinney.id.au> wrote:
> "Kumar McMillan" <kumar.mcmillan at gmail.com> writes:
>
>> This sounds interesting and I'm curious but I don't fully understand
>> it. Could you point me to some examples of writing test scenarios
>> then adapting them? Or did I miss the link to the documentation?
>
> The documentation is the docstrings :-)

To lower the barrier of entry for anyone using your tool (and any
tool) I would suggest publishing documentation online as HTML.  If you
want to go quick and dirty by turning your docstrings into readable
docs there are many tools for this (pydoctor, pudge, epidocs, pydoc)
however I personally would suggest sphinx because it lets you organize
your modules in a more readable fashion (i.e. hide "private" functions
and classes easier).

To get a running start, install sphinx (http://sphinx.pocoo.org/) run
sphinx-quickstart then edit conf.py and turn on the autodoc extension:

extensions = ['sphinx.ext.autodoc']

then make a directory named api and add a file named nose_scenario.rst
and add this at the top:

.. automodule::
   :members:

run make html and there you go!

>
> The examples are in the 'test/' directory of the source distribution.
> Simply install the plugin as per any other 'nose' plugin, and then:
>
>    $ nosetests --with-scenario test/test_unittest.py
>    $ nosetests --with-scenario test/test_testclass.py
>
> They'll partially work as expected, but break in the ways described in
> my original post.
>
>> PS. "homepage" link from the PyPi page above is broken (has a dash but
>> needs an underscore)
>
> Thanks, fixed and uploaded as version 0.1.2
> <URL:http://pypi.python.org/pypi/nose_scenario/0.1.2>.
>
> I look forward to ideas on how to address the issues in my original
> post.
>
> --
>  \       "For of those to whom much is given, much is required." —John |
>  `\                                                        F. Kennedy |
> _o__)                                                                  |
> Ben Finney
>
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>



More information about the testing-in-python mailing list