What are your favorite nose plugins? How do you run Nose?

May 13th, 2008 § 8 comments

So, I am pon­der­ing going all-out with Nose, and I am won­der­ing what plu­g­ins peo­ple find the most use­ful for it, and also how peo­ple are using it.

I see two aspects of nose/any test exe­cu­tion mech­a­nism: Unit test­ing “native” (i.e: python code) and run­ning tests that are more func­tional in nature (i.e: not test­ing python, but instead test­ing a web interface).

What are the fea­tures of nose you found the most useful?

Too bad I couldn’t find a decent nose pick­ing graphic for this one.

  • Stan

    –pdb-failures is extremely use­ful for intro­spect­ing objects right when a unit test fails. Usu­ally I can fig­ure out what went wrong pretty quick thanks to this.

    I also use nose to drive twill-based web­site unit tests:
    (not sure how well this will paste)

    # test.py
    import twill, glob
    from Strin­gIO import Strin­gIO
    from nose import with_setup

    def setup():
    outp = Strin­gIO()
    twill.set_output(outp)

    def run_twill(twill_file):
    script = file(twill_file).read()
    twill.execute_string(‘reset_browser’)
    twill.execute_string(script)

    @with_setup(setup)
    def test_twill():
    for file­name in glob.glob(‘*.twill’):
    yield run_twill, file­name
    ### EOF

    Now you can put all of your web­site tests into .twill files in the cur­rent direc­tory. I sup­pose this could be made into a nose plugin…

  • Stan

    Well, all of the indent­ing was lost, but you get the idea.

  • http://www.swordstyle.com/blog2 Terry Pep­pers

    Man, where do I start? Since my team uses it mainly for test­ing web inter­faces — here’s some things:

    Test gen­er­a­tors are pretty key us. The same fea­ture is in py.test — we use that fea­ture of nose con­stantly on our team here @ work.

    The plu­gin archi­tec­ture has also allowed us to be more flex­i­ble in what we can pass to our func­tional tests. We build cus­tom plu­g­ins to allow more flex­i­ble test col­lec­tion and execution.

    The under­ly­ing sys­tem of test col­lec­tion is what has always attracted me. nose, in gen­eral, allows me to very quickly put together a suite of tests with­out have to deal with UnitTest boilerplate.

  • http://farmdev.com/ Kumar McMil­lan

    I recently dis­cov­ered the builtin plu­gin –with-id and can’t believe I ever lived with­out it. When it’s enabled you get num­bered tests so you can re-run indi­vid­ual ones by say­ing ‘nosetests 23 45‘ instead of typ­ing out long path names.

    I also miss nosetty, a plu­gin I wrote a while ago for 0.9 but have yet to port it to 0.10. Quite a lot has changed in stream han­dling and I started the migra­tion but didn’t fin­ish. It was nice because it let you launch an edi­tor at the exact spot in a trace­back, espe­cially nice if you need to apply a quick, exper­i­men­tal patch to a sys­tem egg.

    I also use NoseGAE for test­ing Google App Engine webapps in-process: http://code.google.com/p/nose-gae/

    btw, the offi­cial (unof­fi­cial?) list of all nose plu­g­ins is here: http://nose-plugins.jottit.com/

  • http://bluesock.org/~willg/ will

    I used the spec plu­gin that comes with Pinoc­chio. At a min­i­mum, it pushes me to write tests that focus on “invari­ants” of the things being tested.

  • http://devlog.waltercruz.com wal­ter­cruz

    Well, I have a lit­tle plu­gin not yet pub­lished, nose-notify. It uses the gnome notify sys­tem, but can be imple­mented with growl on Macintosh.

    http://www.assembla.com/wiki/show/nose_notify

  • programmer.py

    I don’t know if it’s con­sid­ered a plu­gin, but using –with-coverage and –cover-package (you’ll need the cov­er­age mod­ule), is great for find­ing gaps in testing.

  • http://www.topfivesextoys.com/ sex toys

    thanks!

What's this?

You are currently reading What are your favorite nose plugins? How do you run Nose? at jessenoller.com.

meta