vendredi 4 mars 2016

Count and return number of nosetests

I have a set of unit test scripts saved in the pwd. I would like to be able to count the number of unit tests (nosetests) that would be executed (without actually executing them) and return that number into a python variable like this:

>>> number_of_unit_tests = count_unit_tests('.')
>>> number_of_unit_tests

400

I know I can collect from the command line like this:

nosetests --collect-only

But is it possible to do this from within a script?

Aucun commentaire:

Enregistrer un commentaire