Decorators Usage Guide

Decorators Usage Guide

The decorators module

attr(**kwargs)[source]

A decorator which applies the testtools attr decorator

This decorator applies the testtools.testcase.attr if it is in the list of attributes to testtools we want to apply.

idempotent_id(id)[source]

Stub for metadata decorator

related_bug(bug, status_code=None, bug_type='launchpad')[source]

A decorator useful to know solutions from launchpad/storyboard reports

Parameters:
  • bug – The launchpad/storyboard bug number causing the test bug
  • bug_type – ‘launchpad’ or ‘storyboard’, default ‘launchpad’
  • status_code – The status code related to the bug report
skip_because(*args, **kwargs)[source]

A decorator useful to skip tests hitting known bugs

bug must be a number and condition must be true for the test to skip.

Parameters:
  • bug – bug number causing the test to skip (launchpad or storyboard)
  • bug_type – ‘launchpad’ or ‘storyboard’, default ‘launchpad’
  • condition – optional condition to be True for the skip to have place
Raises:

testtools.TestCase.skipException if condition is True and bug is included

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.