Selaa lähdekoodia

Unittest utility decorator: @todo("Reason")

Ask Solem 15 vuotta sitten
vanhempi
commit
9509f8a513
1 muutettua tiedostoa jossa 13 lisäystä ja 0 poistoa
  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