Commits

Anonymous committed ac6d831

testutils: added only_for decorator

  • Participants
  • Parent commits 588fc39

Comments (0)

Files changed (1)

File ropetest/testutils.py

         return do_nothing
 
 
+def only_for(version):
+    """Should be used as a decorator for a unittest.TestCase test method"""
+    def decorator(func):
+        if sys.version >= version:
+            return func
+        else:
+            def do_nothing(self):
+                pass
+            return do_nothing
+    return decorator
+
+
 def run_only_for_unix(func):
     """Should be used as a decorator for a unittest.TestCase test method"""
     if os.name == 'posix':