예제 #1
0
def sanity_function(func):
    warn.user_deprecation_warning(
        'using the @sn.sanity_function decorator from the sn module is '
        'deprecated; please use the built-in decorator @deferrable instead.',
        from_version='3.8.0'
    )
    return deferrable(func)
예제 #2
0
        def sanity_function(fn):
            '''Mark a function as the test's sanity function.

            Decorated functions must be unary and they will be converted into
            deferred expressions.
            '''

            _def_fn = deferrable(fn)
            setattr(_def_fn, '_rfm_sanity_fn', True)
            return _def_fn
예제 #3
0
def sanity_function(fn):
    '''Decorate a test member function to mark it as a sanity check.

    This decorator will convert the given function into a
    :func:`~RegressionMixin.deferrable` and mark it to be executed during the
    test's sanity stage. When this decorator is used, manually assigning a
    value to :attr:`~RegressionTest.sanity_patterns` in the test is not
    allowed.

    Decorated functions may be overridden by derived classes, and derived
    classes may also decorate a different method as the test's sanity
    function. Decorating multiple member functions in the same class is not
    allowed. However, a :class:`RegressionTest` may inherit from multiple
    :class:`RegressionMixin` classes with their own sanity functions. In this
    case, the derived class will follow Python's `MRO
    <https://docs.python.org/3/library/stdtypes.html#class.__mro__>`_ to find
    a suitable sanity function.

    .. versionadded:: 3.7.0
    '''

    _def_fn = deferrable(fn)
    setattr(_def_fn, '_rfm_sanity_fn', True)
    return _def_fn