diff options
Diffstat (limited to 'test/__init__.py')
-rw-r--r-- | test/__init__.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..9f3cdc6 --- /dev/null +++ b/test/__init__.py @@ -0,0 +1,20 @@ +def TODO(func): + """unittest test method decorator that ignores + exceptions raised by test + + Used to annotate test methods for code that may + not be written yet. Ignores failures in the + annotated test method; fails if the text + unexpectedly succeeds. + """ + def wrapper(*args, **kw): + try: + func(*args, **kw) + succeeded = True + except: + succeeded = False + assert succeeded is False, \ + "%s marked TODO but passed" % func.__name__ + wrapper.__name__ = func.__name__ + wrapper.__doc__ = func.__doc__ + return wrapper |