def needs_azure(test_item):
    """
    Use as a decorator before test classes or methods to only run them if Azure is usable.
    """
    test_item = _mark_test('azure', test_item)
    try:
        # noinspection PyUnresolvedReferences
        import azure.storage
    except __HOLE__:
        return unittest.skip("Skipping test. Install toil with the 'azure' extra) to include this "
                             "test.")(test_item)
    except:
        raise
    else:
        from toil.jobStores.azureJobStore import credential_file_path
        full_credential_file_path = os.path.expanduser(credential_file_path)
        if not os.path.exists(full_credential_file_path):
            return unittest.skip("Skipping test. Configure %s with the access key for the "
                                 "'toiltest' storage account." % credential_file_path)(test_item)
        return test_item
dataset/ETHPy150Open BD2KGenomics/toil/src/toil/test/__init__.py/needs_azure