dimanche 28 décembre 2014

passing arguments to nosetest

I write my nose unit tests to be fairly complete, but as a result they can take a while to run. I would like to be able to pass in an optional command-line argument to run some quick version of the tests (e.g. try a handful of possible inputs, instead of every possible input).


Ideally, I'd be able to say something like:


nosetest --quick my_module/tests/my_test.py


And in my_test.py, have:



def test_something():
if nose.command_line_args.quick:
<run quick test>
else:
<run long test>


Is there a simple way to do this? I know that one way might be to write a nose plugin, but I got scared away when the docs said I needed to install any plugins I write using setuptools. Learning setuptools to install a nose plugin all to just pass in a flag is a bit of yak-shaving I'd love to avoid if I can.


Aucun commentaire:

Enregistrer un commentaire