Created
May 28, 2011 20:17
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
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
Thanks for this :)