Disabling Python nosetests

前端 未结 5 1270
南方客
南方客 2020-12-08 18:42

When using nosetests for Python it is possible to disable a unit test by setting the test function\'s __test__ attribute to false. I have implemented this usin

5条回答
  •  醉话见心
    2020-12-08 18:56

    Nose already has a builtin decorator for this:

    from nose.tools import nottest
    
    @nottest
    def test_my_sample_test()
        #code here ...
    

    Also check out the other goodies that nose provides: https://nose.readthedocs.org/en/latest/testing_tools.html

提交回复
热议问题