from functools import wraps
from nose.plugins.attrib import attr
from nose.plugins.skip import SkipTest

__all__ = ['wip']

def fail(message):
    raise AssertionError(message)

def wip(f):
    @wraps(f)
    def run_test(*args, **kwargs):
        try:
            f(*args, **kwargs)
        except Exception as e:
            raise SkipTest("WIP test failed: " + str(e))
        fail("test passed but marked as work in progress")
    return attr('wip')(run_test)


@@ -96,16 +96,26 @@
 SkipTest
+%0Aimport os
 %0A%0A__all_
@@ -467,8 +467,319 @@
 _test)%0A%0A
+def integration(f):%0A    @wraps(f)%0A    def run_test(*args, **kwargs):%0A        integration_run = (os.getenv('INTEGRATION', None) is not None)%0A        if integration_run:%0A            f(*args, **kwargs)%0A        else:%0A            raise SkipTest(%22Skipping integration test%22)%0A    return attr('integration')(run_test)%0A%0A

Add integration test decorator to prevent certain tests running unless we really want them to.