瀏覽代碼

Unittest utility decorator: @todo("Reason")

Ask Solem 15 年之前
父節點
當前提交
9509f8a513
共有 1 個文件被更改,包括 13 次插入0 次删除
  1. 13 0
      celery/tests/utils.py

+ 13 - 0
celery/tests/utils.py

@@ -1,11 +1,24 @@
 from __future__ import with_statement
 from contextlib import contextmanager
 from StringIO import StringIO
+from functools import wraps
 import os
 import sys
 import __builtin__
 
 
+def todo(reason):
+
+    def _wrap_test(fun):
+
+        @wraps(fun)
+        def _skipped_test(*args, **kwargs):
+            sys.stderr.write("(TODO: %s) " % reason)
+
+        return _skipped_test
+    return _wrap_test
+
+
 @contextmanager
 def mask_modules(*modnames):
     """Ban some modules from being importable inside the context