mvpa2.testing.with_tempfile

mvpa2.testing.with_tempfile(*targs, **tkwargs)

Decorator function to provide a temporary file name and remove it at the end.

All arguments are passed into the call to tempfile.mktemp(), and resultant temporary filename is passed as the first argument into the test. If no ‘prefix’ argument is provided, it will be constructed using module and function names (‘.’ replaced with ‘_’).

Example use:

@with_tempfile()
def test_write(tfile):
    open(tfile, 'w').write('silly test')