コード例 #1
0
def get_tyrant_or_SkipTest():
    def emit_no_tyrant_msg(reason):
        global _no_tyrant_msg_emitted
        if not _no_tyrant_msg_emitted:
            sys.stderr.write("\n" + _no_tyrant_msg % reason + "\n")
            _no_tyrant_msg_emitted = True

    if tyrant.pytyrant is None:
        emit_no_tyrant_msg("not installed")
        raise SkipTest("pytyrant library not installed")

    try:
        tb = TyrantBackend()
        try:
            tb.open()
        except socket.error, exc:
            emit_no_tyrant_msg("not running")
            raise SkipTest("Can't connect to Tokyo server: %s" % (exc, ))
        return tb
コード例 #2
0
ファイル: test_tyrant.py プロジェクト: andrewwatts/celery
def get_tyrant_or_None():
    def emit_no_tyrant_msg(reason):
        global _no_tyrant_msg_emitted
        if not _no_tyrant_msg_emitted:
            sys.stderr.write("\n" + _no_tyrant_msg % reason + "\n")
            _no_tyrant_msg_emitted = True

    if tyrant.pytyrant is None:
        return emit_no_tyrant_msg("not installed")
    try:
        tb = TyrantBackend()
        try:
            tb.open()
        except socket.error:
            return emit_no_tyrant_msg("not running")
        return tb
    except ImproperlyConfigured, exc:
        if "need to install" in str(exc):
            return emit_no_tyrant_msg("not installed")
        return emit_no_tyrant_msg("not configured")
コード例 #3
0
ファイル: test_tyrant.py プロジェクト: FreakTheMighty/celery
def get_tyrant_or_SkipTest():

    def emit_no_tyrant_msg(reason):
        global _no_tyrant_msg_emitted
        if not _no_tyrant_msg_emitted:
            sys.stderr.write("\n" + _no_tyrant_msg % reason + "\n")
            _no_tyrant_msg_emitted = True

    if tyrant.pytyrant is None:
        emit_no_tyrant_msg("not installed")
        raise SkipTest("pytyrant library not installed")

    try:
        tb = TyrantBackend()
        try:
            tb.open()
        except socket.error, exc:
            emit_no_tyrant_msg("not running")
            raise SkipTest("Can't connect to Tokyo server: %s" % (exc, ))
        return tb
コード例 #4
0
ファイル: test_tyrant.py プロジェクト: aaronelliotross/celery
def get_tyrant_or_None():

    def emit_no_tyrant_msg(reason):
        global _no_tyrant_msg_emitted
        if not _no_tyrant_msg_emitted:
            sys.stderr.write("\n" + _no_tyrant_msg % reason + "\n")
            _no_tyrant_msg_emitted = True

    if tyrant.pytyrant is None:
        return emit_no_tyrant_msg("not installed")
    try:
        tb = TyrantBackend()
        try:
            tb.open()
        except socket.error, exc:
            if exc.errno == errno.ECONNREFUSED:
                return emit_no_tyrant_msg("not running")
            else:
                raise
        return tb
コード例 #5
0
ファイル: test_tyrant.py プロジェクト: dmishe/celery
def get_tyrant_or_None():

    def emit_no_tyrant_msg():
        global _no_tyrant_msg_emitted
        if not _no_tyrant_msg_emitted:
            sys.stderr.write("\n" + _no_tyrant_msg + "\n")
            _no_tyrant_msg_emitted = True

    if tyrant.pytyrant is None:
        emit_no_tyrant_msg()
        return None
    try:
        tb = TyrantBackend()
        try:
            tb.open()
        except socket.error, exc:
            if exc.errno == errno.ECONNREFUSED:
                emit_no_tyrant_msg()
                return None
            else:
                raise
        return tb