X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=wvtest.py;h=8b5ab647e47e270caccbd67c31789211b32f6ce8;hb=aab82669cb0efd0a275e0ccd14ee779e894455ea;hp=8a8302be10c2daec80a6768625a2183fe0930051;hpb=a69735928c9a5f155711ff500075a5b04d03493f;p=bup.git diff --git a/wvtest.py b/wvtest.py index 8a8302b..8b5ab64 100755 --- a/wvtest.py +++ b/wvtest.py @@ -4,6 +4,7 @@ bup_python="$(dirname "$0")/cmd/bup-python" exec "$bup_python" "$0" ${1+"$@"} """ # end of bup preamble + # # WvTest: # Copyright (C)2007-2012 Versabanq Innovations Inc. and contributors. @@ -11,6 +12,8 @@ exec "$bup_python" "$0" ${1+"$@"} # See the included file named LICENSE for license information. # You can get wvtest from: http://github.com/apenwarr/wvtest # + +from __future__ import absolute_import import atexit import inspect import os @@ -83,6 +86,14 @@ if __name__ != '__main__': # we're imported as a module _result(msg, tb, 'FAILED') return cond + def wvcheck(cond, msg, tb = None): + if tb == None: tb = _caller_stack(2) + if cond: + _result(msg, tb, 'ok') + else: + _result(msg, tb, 'FAILED') + return cond + _code_rx = re.compile(r'^\w+\((.*)\)(\s*#.*)?$') def _code(): text = _caller_stack(2)[3] @@ -144,6 +155,18 @@ if __name__ != '__main__': # we're imported as a module else: return _check(False, 'EXCEPT(%s)' % _code()) + wvstart = WVSTART + wvmsg = WVMSG + wvpass = WVPASS + wvfail = WVFAIL + wvpasseq = WVPASSEQ + wvpassne = WVPASSNE + wvpaslt = WVPASSLT + wvpassle = WVPASSLE + wvpassgt = WVPASSGT + wvpassge = WVPASSGE + wvexcept = WVEXCEPT + def wvfailure_count(): return _fails