mercredi 1 avril 2015

Python Unit-Testing: In Nose is there a way to skip a test case from nose.run()?

I am writing a set of test cases say Test1, Test2 in a test module.


Is there a way to skip Test1 or selectively execute only Test2 in that module using the command nose.main()?


My module contains,


test_module.py,



class Test1:
setUp(self):
print('setup')
tearDown(self):
print('teardown')
test(self):
print('test1')

class Test2:
setUp(self):
print('setup')
tearDown(self):
print('teardown')
test(self):
print('test2')


I run it from a different python file using,



if __name__ == '__main__':
nose.main('test_module')

Aucun commentaire:

Enregistrer un commentaire