With unittest it is possible to run specific tests from the cli.
When using ddt this doesn't seem to be possible.
Example:
import unittest
from ddt import data, ddt
class Test(unittest.TestCase):
def test(self):
self.assertEqual(1, 1)
@ddt
class TestDDT(unittest.TestCase):
@data('arg1', 'arg2')
def test(self, arg='arg1'):
self.assertEqual(1, 1)
if __name__ == '__main__':
unittest.main(exit=False)
Running specific unittest:
$ python test.py Test.test
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
Running specific unittest with ddt:
$ python test.py TestDDT.test
E
======================================================================
ERROR: test (unittest.loader._FailedTest)
----------------------------------------------------------------------
AttributeError: type object 'TestDDT' has no attribute 'test'
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (errors=1)
With
unittestit is possible to run specific tests from the cli.When using
ddtthis doesn't seem to be possible.Example:
Running specific unittest:
Running specific unittest with ddt: