testing.decorators

Module: testing.decorators

Extend numpy’s decorators to use nipy’s gui and data labels.

This module should not import nose at the top level to avoid a run-time dependency on nose.

Functions

nipy.testing.decorators.if_datasource(ds, msg)[source]
nipy.testing.decorators.if_example_data(f)[source]
nipy.testing.decorators.if_templates(f)[source]
nipy.testing.decorators.knownfailure(f)[source]
nipy.testing.decorators.make_label_dec(label, ds=None)[source]

Factory function to create a decorator that applies one or more labels.

Parameters

label : str or sequence

One or more labels that will be applied by the decorator to the functions it decorates. Labels are attributes of the decorated function with their value set to True.

ds : str

An optional docstring for the resulting decorator. If not given, a default docstring is auto-generated.

Returns

ldec : function

A decorator.

Examples

>>> slow = make_label_dec('slow')
>>> print(slow.__doc__)
Labels a test as 'slow'
>>> rare = make_label_dec(['slow','hard'],
... "Mix labels 'slow' and 'hard' for rare tests")
>>> @rare
... def f(): pass
...
>>>
>>> f.slow
True
>>> f.hard
True
nipy.testing.decorators.needs_mpl_agg(func)[source]

Decorator requiring matplotlib with agg backend

nipy.testing.decorators.needs_review(msg)[source]

Skip a test that needs further review.

Parameters

msg : string

msg regarding the review that needs to be done