Ejemplo n.º 1
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)
Ejemplo n.º 2
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 11
0
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)
Ejemplo n.º 12
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 19
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 24
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)
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 31
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 39
0
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 43
0
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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 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)