Beispiel #1
0
def test_check_wrapper_title():
    class Mock(object):
        pass

    def mock_fun():
        return Mock()

    f = check_wrapper(mock_fun)
    nt.assert_equal(f().title, "Mock fun")
Beispiel #2
0
def test_check_wrapper_title():
    class Mock(object):
        pass

    def mock_fun():
        return Mock()

    f = check_wrapper(mock_fun)
    nt.assert_equal(f().title, "Mock fun")
Beispiel #3
0
def test_check_wrapper_title():
    class Mock:
        pass

    def mock_fun():
        return Mock()

    f = check_wrapper(mock_fun)
    assert f().title == "Mock fun"
Beispiel #4
0
    def _do_check(self, obj, check_module, check_str):
        '''Run a check function on obj'''
        opts = self._config['options']
        if check_str in opts:
            fargs = opts[check_str]
            if isinstance(fargs, list):
                out = check_wrapper(getattr(check_module, check_str))(obj, *fargs)
            else:
                out = check_wrapper(getattr(check_module, check_str))(obj, fargs)
        else:
            out = check_wrapper(getattr(check_module, check_str))(obj)

        try:
            if out.info:
                L.debug('%s: %d failing ids detected: %s',
                        out.title, len(out.info), out.info)
        except TypeError:  # pragma: no cover
            pass

        return out
Beispiel #5
0
    def _do_check(self, obj, check_module, check_str):
        '''Run a check function on obj'''
        opts = self._config['options']
        if check_str in opts:
            fargs = opts[check_str]
            if isinstance(fargs, list):
                out = check_wrapper(getattr(check_module, check_str))(obj, *fargs)
            else:
                out = check_wrapper(getattr(check_module, check_str))(obj, fargs)
        else:
            out = check_wrapper(getattr(check_module, check_str))(obj)

        try:
            if len(out.info) > 0:
                L.debug('%s: %d failing ids detected: %s',
                        out.title, len(out.info), out.info)
        except TypeError:
            pass

        return out