diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:06:57 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:06:57 +0000 |
commit | a3eed2c248067f0319cb72bcc8b5e2c7054ea6dc (patch) | |
tree | fd79d650c7ffee81608955be5f4fd8edd791834e /testenv/conf/expected_ret_code.py | |
parent | Initial commit. (diff) | |
download | wget-a3eed2c248067f0319cb72bcc8b5e2c7054ea6dc.tar.xz wget-a3eed2c248067f0319cb72bcc8b5e2c7054ea6dc.zip |
Adding upstream version 1.20.1.upstream/1.20.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testenv/conf/expected_ret_code.py')
-rw-r--r-- | testenv/conf/expected_ret_code.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/testenv/conf/expected_ret_code.py b/testenv/conf/expected_ret_code.py new file mode 100644 index 0000000..87cba13 --- /dev/null +++ b/testenv/conf/expected_ret_code.py @@ -0,0 +1,27 @@ +from exc.test_failed import TestFailed +from conf import hook + +""" Post-Test Hook: ExpectedRetCode +This is a post-test hook which checks if the exit code of the Wget instance +under test is the same as that expected. As a result, this is a very important +post test hook which is checked in all the tests. +Returns a TestFailed exception if the return code does not match the expected +value. Else returns gracefully. +""" + + +@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) |