cocotb_wrapper.testbench._Test#

class cocotb_wrapper.testbench._Test(test_function, test_id=1, timeout_time=None, timeout_unit='step', expect_fail=False, expect_error=(), skip=False, stage=0)[source]#

A single test of a testbench.

This class is not intended to be instantiated directly. Instead use Testbench to create a testbench and register tests with register_test().

Parameters:
  • test_function (Callable[[HierarchyObject], Awaitable[None]]) –

  • test_id (int) –

  • timeout_time (int | None) –

  • timeout_unit (str) –

  • expect_fail (bool) –

  • expect_error (Exception | tuple[Exception, ...]) –

  • skip (bool) –

  • stage (int) –

__init__(test_function, test_id=1, timeout_time=None, timeout_unit='step', expect_fail=False, expect_error=(), skip=False, stage=0)[source]#

Initialize an instance.

Parameters:
  • test_function (Callable[[HierarchyObject], Awaitable[None]]) – The test function

  • test_id (int) – The test identifier

  • timeout_time (int | None) – The duration before a timeout occurs

  • timeout_unit (str) – The unit of the timeout time

  • expect_fail (bool) – Don’t mark the test as failed if the test fails.

  • expect_error (Exception | tuple[Exception, ...]) – Mark the test as passed only if the given exception is raised

  • skip (bool) – Skip this test

  • stage (int) – Order tests logically into stages, where multiple test can share a stage

Methods