"""
raven.utils.tests
~~~~~~~~~~~~~~~~~

:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""

NOTSET = object()


class fixture(object):
    """
    >>> class Foo(object):
    >>>     @fixture
    >>>     def foo(self):
    >>>         # calculate something important here
    >>>         return 42
    """
    def __init__(self, func):
        self.__name__ = func.__name__
        self.__module__ = func.__module__
        self.__doc__ = func.__doc__
        self.func = func

    def __get__(self, obj, type=None):
        if obj is None:
            return self
        value = obj.__dict__.get(self.__name__, NOTSET)
        if value is NOTSET:
            value = self.func(obj)
            obj.__dict__[self.__name__] = value
        return value

@@ -158,16 +158,83 @@
 ils.%0A%22%22%22
+%0Afrom functools import wraps%0Afrom nose.plugins.skip import SkipTest
 %0A%0ANOTSET
@@ -883,12 +883,476 @@
 eturn value%0A
+%0A%0Adef requires(condition, msg=None):%0A    %22%22%22%0A    %3E%3E%3E class Foo(object):%0A    %3E%3E%3E     @requires(lambda x: sys.version_info %3E= (2, 6, 0))%0A    %3E%3E%3E     def foo(self):%0A    %3E%3E%3E         # do something that doesnt work on py2.5%0A    %3E%3E%3E         pass%0A    %22%22%22%0A    def wrapped(func):%0A        @wraps(func)%0A        def inner(*args, **kwargs):%0A            if not condition:%0A                raise SkipTest(msg or '')%0A            return func%0A        return inner%0A    return wrapped%0A

Add @requires for skipping tests