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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
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)
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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
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)
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)
Beispiel #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)
Beispiel #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)
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)
Beispiel #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)
Beispiel #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)