Skip to content

run specific tests from cli #66

@tadly

Description

@tadly

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions