def rmtemp(f, *args, **kwargs):
    'Wrapper to centralize removing of temp files so we could keep them around\n\n    It will not remove the temporary file/directory if DATALAD_TESTS_TEMP_KEEP\n    environment variable is defined\n    '
    if (not os.environ.get('DATALAD_TESTS_TEMP_KEEP')):
        if (not os.path.lexists(f)):
            lgr.debug("Path %s does not exist, so can't be removed", f)
            return
        lgr.log(5, 'Removing temp file: %s', f)
        if isdir(f):
            rmtree(f, *args, **kwargs)
        else:
            unlink(f)
    else:
        lgr.info('Keeping temp file: %s', f)
Wrapper to centralize removing of temp files so we could keep them around

It will not remove the temporary file/directory if DATALAD_TESTS_TEMP_KEEP
environment variable is defined
def rmtemp(f, *args, **kwargs):
    'Wrapper to centralize removing of temp files so we could keep them around\n\n    It will not remove the temporary file/directory if DATALAD_TESTS_TEMP_KEEP\n    environment variable is defined\n    '
    if (not os.environ.get('DATALAD_TESTS_TEMP_KEEP')):
        if (not os.path.lexists(f)):
            lgr.debug("Path %s does not exist, so can't be removed", f)
            return
        lgr.log(5, 'Removing temp file: %s', f)
        if isdir(f):
            rmtree(f, *args, **kwargs)
        else:
            unlink(f)
    else:
        lgr.info('Keeping temp file: %s', f)