How to use the colin.utils.cmd_tools.retry function in colin

To help you get started, we’ve selected a few colin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github user-cont / colin / tests / unit / test_utils.py View on Github external
    @retry(5, 0)
    def sleep_like_a_baby():
        global COUNTER
        if COUNTER < 3:
            COUNTER += 1
            raise Exception("sleeping")
        return []
github user-cont / colin / tests / unit / test_utils.py View on Github external
    @retry(5, -1)
    def fail_negative_sleep():
        raise_exception()
github user-cont / colin / tests / unit / test_utils.py View on Github external
def test_wrong_parameter():
    with pytest.raises(ValueError) as ex:
        retry(-1, 1)
    assert str(ex.value) == 'retry_count have to be positive'

    with pytest.raises(ValueError) as ex:
        retry(0, 1)
    assert str(ex.value) == 'retry_count have to be positive'

    @retry(5, -1)
    def fail_negative_sleep():
        raise_exception()

    with pytest.raises(ValueError) as ex:
        fail_negative_sleep()
    assert str(ex.value) == 'sleep length must be non-negative'
github user-cont / colin / tests / unit / test_utils.py View on Github external
    @retry(5, 0)
    def always_success():
        global COUNTER
        COUNTER = COUNTER + 1

        return 42
github user-cont / colin / tests / unit / test_utils.py View on Github external
    @retry(5, 0)
    def always_raise_exception():
        raise_exception()
github user-cont / colin / tests / unit / test_utils.py View on Github external
    @retry(4, .5)
    def fail_and_sleep():
        raise_exception()
github user-cont / colin / tests / unit / test_utils.py View on Github external
def test_wrong_parameter():
    with pytest.raises(ValueError) as ex:
        retry(-1, 1)
    assert str(ex.value) == 'retry_count have to be positive'

    with pytest.raises(ValueError) as ex:
        retry(0, 1)
    assert str(ex.value) == 'retry_count have to be positive'

    @retry(5, -1)
    def fail_negative_sleep():
        raise_exception()

    with pytest.raises(ValueError) as ex:
        fail_negative_sleep()
    assert str(ex.value) == 'sleep length must be non-negative'