Tests

Tests are defined using the @test decorator

class cocotb.decorators.test(timeout=None, expect_fail=False, expect_error=False, skip=False, stage=None)[source]

Decorator to mark a function as a test

All tests are coroutines. The test decorator provides some common reporting etc, a test timeout and allows us to mark tests as expected failures.

Parameters:
  • timeout (int, optional) – value representing simulation timeout (not implemented).
  • expect_fail (bool, optional) – Don’t mark the result as a failure if the test fails.
  • expect_error (bool, optional) – Don’t mark the result as an error if an error is raised. This is for cocotb internal regression use.
  • skip (bool, optional) – Don’t execute this test as part of the regression.
  • stage (int, optional) – Order tests logically into stages, where multiple tests can share a stage.