testing.decorators_trial — IPython v0.10 documentation

### Navigation

- index
- modules |
- next |
- previous |
- IPython v0.10 documentation »
- The IPython API »

# testing.decorators_trial

## Module: `testing.decorators_trial`

Testing related decorators for use with twisted.trial.

The decorators in this files are designed to follow the same API as those in the decorators module (in this same directory). But they can be used with twisted.trial

## Functions

`IPython.testing.decorators_trial.` `numpy_not_available`()

  Can numpy be imported? Returns true if numpy does NOT import.

  This is used to make a decorator to skip tests that require numpy to be available, but delay the ‘import numpy’ to test execution time.

`IPython.testing.decorators_trial.` `skip`(msg=None)

  Create a decorator that marks a test function for skipping.

  This is a decorator factory that returns a decorator that will cause tests to be skipped.

  Parameters: | msg : str Optional message to be added.
  Returns: | decorator : function Decorator, which, when applied to a function, sets the skip attribute of the function causing twisted.trial to skip it.

`IPython.testing.decorators_trial.` `skipif`(skip_condition, msg=None)

  Create a decorator that marks a test function for skipping.

  The is a decorator factory that returns a decorator that will conditionally skip a test based on the value of skip_condition. The skip_condition argument can either be a boolean or a callable that returns a boolean.

  Parameters: | skip_condition : boolean or callable If this evaluates to True, the test is skipped. msg : str The message to print if the test is skipped.
  Returns: | decorator : function The decorator function that can be applied to the test function.

### Navigation

- index
- modules |
- next |
- previous |
- IPython v0.10 documentation »
- The IPython API »