2008-08-05 / 23:25 / dave

This took more than 5 google minutes, so maybe it’s worth sharing.

You can make nose run the same way as unittest’s main by using nose.runmodule().

In gratuitous detail:

import nose

def test_foo():
    assert True

if __name__ == '__main__':
    nose.runmodule()

Using nose.run() activates nose’s test discovery. Test discovery is pretty useful for running a bunch of tests, but rumodule() allows for the snappy (ultra-snappy, thanks to Gary Bishop) C-c C-c in python-mode.