List all Tests Found by Nosetest

前端 未结 3 537
终归单人心
终归单人心 2021-01-01 09:11

I use nosetests to run my unittests and it works well. I want to get a list of all the tests nostests finds without actually running them. Is there

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-01 09:22

    I recommend using:

    nosetests -vv --collect-only
    

    While the -vv option is not described in man nosetests, "An Extended Introduction to the nose Unit Testing Framework" states that:

    Using the -vv flag gives you verbose output from nose's test discovery algorithm. This will tell you whether or not nose is even looking in the right place(s) to find your tests.

    The -vv option can save time when trying to determine why nosetests is only finding some of your tests. (In my case, it was because nosetests skipped certain tests because the .py scripts were executable.)

    Bottom line is that the -vv option is incredibly handy, and I almost always use it instead of the -v option.

提交回复
热议问题