Skip to content

Test Case¤

TestCase dataclass ¤

TestCase(
    node_id: str,
    path: str,
    name: str,
    doc: str,
    markers: List[str],
    parameters: Dict[str, str],
    node_type: str = "case",
    module: Optional[str] = None,
    suite: Optional[str] = None,
    function: Optional[str] = None,
)

A collected test case.

doc instance-attribute ¤

doc: str

The test docstring (optional).

function class-attribute instance-attribute ¤

function: Optional[str] = None

The function name (optional).

markers instance-attribute ¤

markers: List[str]

The test markers. Each marker is a string.

module class-attribute instance-attribute ¤

module: Optional[str] = None

The module name where the test case is defined (optional).

name instance-attribute ¤

name: str

Test Name

node_id instance-attribute ¤

node_id: str

The node ID of the test case.

node_type class-attribute instance-attribute ¤

node_type: str = 'case'

The node type. Always set to 'case'.

parameters instance-attribute ¤

parameters: Dict[str, str]

Test parameters names and types. Each key is a parameter name and each value is a parameter type as a string.

path instance-attribute ¤

path: str

The file path where the test case is defined.

suite class-attribute instance-attribute ¤

suite: Optional[str] = None

The test suite name where the test case is defined (optional).