def run_only_if_gearman_is_available(func):
    try:
        import gearman
    except ImportError:
        gearman = None
    pred = lambda: gearman is not None
    return run_only(func, pred)
예제 #2
0
파일: testmysql.py 프로젝트: Affirm/Diamond
def run_only_if_MySQLdb_is_available(func):
    try:
        import MySQLdb
    except ImportError:
        MySQLdb = None
    pred = lambda: MySQLdb is not None
    return run_only(func, pred)
예제 #3
0
def run_only_if_statsd_is_available(func):
    try:
        import statsd
    except ImportError:
        statsd = None
    pred = lambda: statsd is not None
    return run_only(func, pred)
예제 #4
0
def run_only_if_libvirt_is_available(func):
    try:
        import libvirt
    except ImportError:
        libvirt = None
    pred = lambda: libvirt is not None
    return run_only(func, pred)
예제 #5
0
def run_only_if_bernhard_is_available(func):
    try:
        import bernhard
    except ImportError:
        bernhard = None
    pred = lambda: bernhard is not None
    return run_only(func, pred)
예제 #6
0
def run_only_if_yaml_is_available(func):
    try:
        import yaml
    except ImportError:
        yaml = None
    pred = lambda: yaml is not None
    return run_only(func, pred)
예제 #7
0
def run_only_if_ElementTree_is_available(func):
    try:
        from xml.etree import ElementTree
    except ImportError:
        ElementTree = None
    pred = lambda: ElementTree is not None
    return run_only(func, pred)
예제 #8
0
def run_only_if_docker_client_is_available(func):
    try:
        from docker import Client
    except ImportError:
        Client = None
    pred = lambda: Client is not None
    return run_only(func, pred)
예제 #9
0
def run_only_if_docker_is_available(func):
  try:
    import docker
  except ImportError:
    docker = None
    pred = lambda: docker is not None
    return run_only(func, pred)
예제 #10
0
def run_only_if_bernhard_is_available(func):
    try:
        import bernhard
    except ImportError:
        bernhard = None
    pred = lambda: bernhard is not None
    return run_only(func, pred)
def run_only_if_psutil_is_available(func):
    try:
        import psutil
    except ImportError:
        psutil = None
    pred = lambda: psutil is not None
    return run_only(func, pred)
def run_only_if_docker_client_is_available(func):
    try:
        from docker import Client
    except ImportError:
        Client = None
    pred = lambda: Client is not None
    return run_only(func, pred)
예제 #13
0
def run_only_if_psycopg2_is_available(func):
    try:
        import psycopg2
    except ImportError:
        psycopg2 = None
    pred = lambda: psycopg2 is not None
    return run_only(func, pred)
예제 #14
0
def run_only_if_pymongo_is_available(func):
    try:
        import pymongo
    except ImportError:
        pymongo = None
    pred = lambda: pymongo is not None
    return run_only(func, pred)
예제 #15
0
def run_only_if_psycopg2_is_available(func):
    try:
        import psycopg2
    except ImportError:
        psycopg2 = None
    pred = lambda: psycopg2 is not None
    return run_only(func, pred)
예제 #16
0
def run_only_if_boto_is_available(func):
    try:
        import boto
    except ImportError:
        boto = None
    pred = lambda: boto is not None
    return run_only(func, pred)
예제 #17
0
def run_only_if_pymongo_is_available(func):
    try:
        import pymongo
    except ImportError:
        pymongo = None
    pred = lambda: pymongo is not None
    return run_only(func, pred)
예제 #18
0
def run_only_if_MySQLdb_is_available(func):
    try:
        import MySQLdb
    except ImportError:
        MySQLdb = None
    pred = lambda: MySQLdb is not None
    return run_only(func, pred)
예제 #19
0
파일: testxen.py 프로젝트: Affirm/Diamond
def run_only_if_libvirt_is_available(func):
    try:
        import libvirt
    except ImportError:
        libvirt = None
    pred = lambda: libvirt is not None
    return run_only(func, pred)
예제 #20
0
def run_only_if_influxdb_is_available(func):
    try:
        import influxdb
    except ImportError:
        influxdb = None
    pred = lambda: influxdb is not None
    return run_only(func, pred)
예제 #21
0
def run_only_if_beanstalkc_is_available(func):
    try:
        import beanstalkc
    except ImportError:
        beanstalkc = None
    pred = lambda: beanstalkc is not None
    return run_only(func, pred)
예제 #22
0
def run_only_if_ElementTree_is_available(func):
    try:
        from xml.etree import ElementTree
    except ImportError:
        ElementTree = None
    pred = lambda: ElementTree is not None
    return run_only(func, pred)
예제 #23
0
def run_only_if_gearman_is_available(func):
    try:
        import gearman
    except ImportError:
        gearman = None
    pred = lambda: gearman is not None
    return run_only(func, pred)
예제 #24
0
파일: testelb.py 프로젝트: 1and1/Diamond
def run_only_if_boto_is_available(func):
    try:
        import boto
    except ImportError:
        boto = None
    pred = lambda: boto is not None
    return run_only(func, pred)
def run_only_if_statsd_is_available(func):
    try:
        import statsd
        statsd  # workaround for pyflakes issue #13
    except ImportError:
        statsd = None
    pred = lambda: statsd is not None
    return run_only(func, pred)
예제 #26
0
def run_only_if_psutil_is_available(func):
    try:
        import psutil
        psutil  # workaround for pyflakes issue #13
    except ImportError:
        psutil = None
    pred = lambda: psutil is not None
    return run_only(func, pred)
예제 #27
0
def run_only_if_yaml_is_available(func):
    try:
        import yaml
        yaml  # workaround for pyflakes issue #13
    except ImportError:
        yaml = None
    pred = lambda: yaml is not None
    return run_only(func, pred)
예제 #28
0
def run_only_if_yaml_is_available(func):
    try:
        import yaml
        yaml  # workaround for pyflakes issue #13
    except ImportError:
        yaml = None
    pred = lambda: yaml is not None
    return run_only(func, pred)
예제 #29
0
def run_only_if_pymongo_is_available(func):
    try:
        import pymongo
        pymongo  # workaround for pyflakes issue #13
    except ImportError:
        pymongo = None
    pred = lambda: pymongo is not None
    return run_only(func, pred)
예제 #30
0
def run_only_if_redis_is_available(func):
    try:
        import redis
        redis  # workaround for pyflakes issue #13
    except ImportError:
        redis = None
    pred = lambda: redis is not None
    return run_only(func, pred)
예제 #31
0
파일: testmysql.py 프로젝트: tipbit/Diamond
def run_only_if_MySQLdb_is_available(func):
    try:
        import MySQLdb
        MySQLdb  # workaround for pyflakes issue #13
    except ImportError:
        MySQLdb = None
    pred = lambda: MySQLdb is not None
    return run_only(func, pred)
예제 #32
0
def run_only_if_docker_client_is_available(func):
    try:
        from docker import Client
        Client  # workaround for pyflakes issue #13
    except ImportError:
        Client = None
    pred = lambda: Client is not None
    return run_only(func, pred)
예제 #33
0
def run_only_if_bernhard_is_available(func):
    try:
        import bernhard
        bernhard  # workaround for pyflakes issue #13
    except ImportError:
        bernhard = None
    pred = lambda: bernhard is not None
    return run_only(func, pred)
예제 #34
0
def run_only_if_psutil_is_available(func):
    try:
        import psutil
        psutil  # workaround for pyflakes issue #13
    except ImportError:
        psutil = None
    pred = lambda: psutil is not None
    return run_only(func, pred)
예제 #35
0
def run_only_if_MySQLdb_is_available(func):
    try:
        import MySQLdb
        MySQLdb  # workaround for pyflakes issue #13
    except ImportError:
        MySQLdb = None
    pred = lambda: MySQLdb is not None
    return run_only(func, pred)
예제 #36
0
def run_only_if_bernhard_is_available(func):
    try:
        import bernhard
        bernhard  # workaround for pyflakes issue #13
    except ImportError:
        bernhard = None
    pred = lambda: bernhard is not None
    return run_only(func, pred)
def run_only_if_beanstalkc_is_available(func):
    try:
        import beanstalkc
        beanstalkc  # workaround for pyflakes issue #13
    except ImportError:
        beanstalkc = None
    pred = lambda: beanstalkc is not None
    return run_only(func, pred)
예제 #38
0
def run_only_if_libvirt_is_available(func):
    try:
        import libvirt
        libvirt  # workaround for pyflakes issue #13
    except ImportError:
        libvirt = None
    pred = lambda: libvirt is not None
    return run_only(func, pred)
예제 #39
0
파일: testkafka.py 프로젝트: x22x22/Diamond
def run_only_if_ElementTree_is_available(func):
    try:
        from xml.etree import ElementTree
        ElementTree  # workaround for pyflakes issue #13
    except ImportError:
        ElementTree = None
    pred = lambda: ElementTree is not None
    return run_only(func, pred)
예제 #40
0
def run_only_if_beanstalkc_is_available(func):
    try:
        import beanstalkc
        beanstalkc  # workaround for pyflakes issue #13
    except ImportError:
        beanstalkc = None
    pred = lambda: beanstalkc is not None
    return run_only(func, pred)
예제 #41
0
def run_only_if_docker_client_is_available(func):
    try:
        from docker import Client
        Client  # workaround for pyflakes issue #13
    except ImportError:
        Client = None
    pred = lambda: Client is not None
    return run_only(func, pred)
예제 #42
0
def run_only_if_boto_is_available(func):
    try:
        import boto
        boto  # workaround for pyflakes issue #13
    except ImportError:
        boto = None
    pred = lambda: boto is not None
    return run_only(func, pred)
예제 #43
0
파일: testkafka.py 프로젝트: greglu/Diamond
def run_only_if_ElementTree_is_available(func):
    try:
        from xml.etree import ElementTree
        ElementTree  # workaround for pyflakes issue #13
    except ImportError:
        ElementTree = None
    pred = lambda: ElementTree is not None
    return run_only(func, pred)
예제 #44
0
def run_only_if_pymongo_is_available(func):
    try:
        import pymongo
        pymongo  # workaround for pyflakes issue #13
    except ImportError:
        pymongo = None
    pred = lambda: pymongo is not None
    return run_only(func, pred)
def run_only_if_libvirt_is_available(func):
    try:
        import libvirt
        libvirt  # workaround for pyflakes issue #13
    except ImportError:
        libvirt = None
    pred = lambda: libvirt is not None
    return run_only(func, pred)
예제 #46
0
def run_only_if_redis_is_available(func):
    """Decorator for checking if python-redis is available.
    Note: this test will be silently skipped if python-redis is missing.
    """
    try:
        import redis
    except ImportError:
        redis = None
    return run_only(func, lambda: redis is not None)
예제 #47
0
def run_only_if_pyrabbit_is_available(func):
    pyrabbit = None
    if sys.version_info > (2, 5):
        try:
            import pyrabbit
        except ImportError:
            pyrabbit = None
    pred = lambda: pyrabbit is not None
    return run_only(func, pred)
예제 #48
0
def run_only_if_major_is_available(func):
    try:
        import os
        os.major
        major = True
    except AttributeError:
        major = None
    pred = lambda: major is not None
    return run_only(func, pred)
예제 #49
0
def run_only_if_pyrabbit_is_available(func):
    pyrabbit = None
    if sys.version_info > (2, 5):
        try:
            import pyrabbit
        except ImportError:
            pyrabbit = None
    pred = lambda: pyrabbit is not None
    return run_only(func, pred)
예제 #50
0
def run_only_if_requests_is_available(func):
    try:
        from oauthlib import oauth2
        import requests_oauthlib
    except ImportError:
        oauth2 = None
        requests_oauthlib = None
    pred = lambda: oauth2 is not None and requests_oauthlib is not None
    return run_only(func, pred)
예제 #51
0
def run_only_if_major_is_available(func):
    try:
        import os
        os.major
        major = True
    except AttributeError:
        major = None
    pred = lambda: major is not None
    return run_only(func, pred)
예제 #52
0
def run_only_if_kitchen_is_available(func):
    if sys.version_info < (2, 7):
        try:
            from kitchen.pycompat27 import subprocess
        except ImportError:
            subprocess = None
    else:
        import subprocess
    pred = lambda: subprocess is not None
    return run_only(func, pred)
예제 #53
0
def run_only_if_pyrabbit_is_available(func):
    pyrabbit = None
    if sys.version_info > (2, 5):
        try:
            import pyrabbit
            pyrabbit  # workaround for pyflakes issue #13
        except ImportError:
            pyrabbit = None
    pred = lambda: pyrabbit is not None
    return run_only(func, pred)
예제 #54
0
def run_only_if_redis_is_available(func):
    """Decorator for checking if python-redis is available.
    Note: this test will be silently skipped if python-redis is missing.
    """
    try:
        import redis
        redis  # workaround for pyflakes issue #13
    except ImportError:
        redis = None
    pred = lambda: redis is not None
    return run_only(func, pred)
예제 #55
0
def run_only_if_pyutmp_is_available(func):
    try:
        import pyutmp
    except ImportError:
        pyutmp = None
    try:
        import utmp
    except ImportError:
        utmp = None
    pred = lambda: pyutmp is not None or utmp is not None
    return run_only(func, pred)