def needs_aws(test_item):
    """
    Use as a decorator before test classes or methods to only run them if AWS usable.
    """
    test_item = _mark_test('aws', test_item)
    try:
        # noinspection PyUnresolvedReferences
        import boto
    except __HOLE__:
        return unittest.skip("Skipping test. Install toil with the 'aws' extra to include this "
                             "test.")(test_item)
    except:
        raise
    else:
        dot_boto_path = os.path.expanduser('~/.boto')
        dot_aws_credentials_path = os.path.expanduser('~/.aws/credentials')
        hv_uuid_path = '/sys/hypervisor/uuid'
        if (os.path.exists(dot_boto_path)
            or os.path.exists(dot_aws_credentials_path)
            # Assume that EC2 machines like the Jenkins slave that we run CI on will have IAM roles
            or os.path.exists(hv_uuid_path) and file_begins_with(hv_uuid_path,'ec2')):
            return test_item
        else:
            return unittest.skip("Skipping test. Create ~/.boto or ~/.aws/credentials to include "
                                 "this test.")(test_item)
dataset/ETHPy150Open BD2KGenomics/toil/src/toil/test/__init__.py/needs_aws