1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00
wget/testenv/conf/expected_ret_code.py
2014-07-24 16:51:58 +05:30

20 lines
687 B
Python

from exc.test_failed import TestFailed
from conf import hook
@hook(alias='ExpectedRetcode')
class ExpectedRetCode:
def __init__(self, expected_ret_code):
self.expected_ret_code = expected_ret_code
def __call__(self, test_obj):
if test_obj.ret_code != self.expected_ret_code:
if test_obj.ret_code == 45:
failure = "Memory Leak Found by Valgrind"
else:
failure = "Return codes do not match.\n" \
"Expected: %s\n" \
"Actual: %s" % (self.expected_ret_code,
test_obj.ret_code)
raise TestFailed(failure)