Skip to content

Instantly share code, notes, and snippets.

@npryce
Created May 28, 2011 20:17
Show Gist options
  • Save npryce/997195 to your computer and use it in GitHub Desktop.
Save npryce/997195 to your computer and use it in GitHub Desktop.
Decorator to mark tests as work in progress for Python's Nose testing framework
from functools import wraps
from nose.plugins.attrib import attr
from nose.plugins.skip import SkipTest
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)
@ninowalker
Copy link

Thanks for this :)

@catermelon
Copy link

This is awesome - I am totes stealing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment