[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/4] Fix silent failure of tests/runtestfedabipkgdiff.py
Hello Chenxiong,
[I am re-sending this as I forgot to add the mailing list in CC the first
time. Sorry.]
It turns out the test <builddir>/tests/runtestfedabipkgdiff.py is
failing, but "make check TESTS=runtestfedabipkgdiff.py" is not.
In other words, runtestfedabipkgdiff.py is failing silently; we don't
see it when doing "make check".
The reason why runtestfedabipkgdiff.py is failing is that
mockfedabipkgdiff is trying to patch the global variable
DEFAULT_KOJI_TOPDIR from the fedabipkgdiff file; and that global
variable is not present in that file. The right global variable that
we want is DEFAULT_KOJI_TOPURL.
This patch fixes that issue.
The reason why the failing above is silent is because the the main
function wasn't returning 0 upon success and 1 otherwise.
This patch fixes that issue as well.
So with this patch, <builddir>/tests/runtestfedabipkgdiff does not
fail anymore and when it does, the "make check TESTS=runtestfedabipkgdiff.py"
fails as well.
* tests/mockfedabipkgdiff.in (run_fedabipkgdiff): Patch
fedabipkgdiff.DEFAULT_KOJI_TOPURL instead of
fedabipkgdiff.DEFAULT_KOJI_TOPDIR.
* tests/runtestfedabipkgdiff.py.in (main): Properly return 0 upon
success, 1 otherwise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
---
tests/mockfedabipkgdiff.in | 2 +-
tests/runtestfedabipkgdiff.py.in | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/tests/mockfedabipkgdiff.in b/tests/mockfedabipkgdiff.in
index 2141983..68d26fa 100644
--- a/tests/mockfedabipkgdiff.in
+++ b/tests/mockfedabipkgdiff.in
@@ -359,7 +359,7 @@ class MockClientSession(object):
@patch('koji.ClientSession', new=MockClientSession)
-@patch('fedabipkgdiff.DEFAULT_KOJI_TOPDIR', new=TEST_TOPDIR)
+@patch('fedabipkgdiff.DEFAULT_KOJI_TOPURL', new=TEST_TOPDIR)
@patch('fedabipkgdiff.DEFAULT_ABIPKGDIFF', new=ABIPKGDIFF)
@patch('fedabipkgdiff.get_download_dir', side_effect=mock_get_download_dir)
def run_fedabipkgdiff(get_download_dir):
diff --git a/tests/runtestfedabipkgdiff.py.in b/tests/runtestfedabipkgdiff.py.in
index 55761c0..9777415 100755
--- a/tests/runtestfedabipkgdiff.py.in
+++ b/tests/runtestfedabipkgdiff.py.in
@@ -150,14 +150,13 @@ def main():
This creates the output directory and launches the tests for the
fedabipkgdiff program.
+ :return: 0 upon success, 1 otherwise.
"""
ensure_output_dir_created()
result = 0
result = run_fedabipkgdiff_tests()
- if not result:
- return result
-
+ return not result
if __name__ == '__main__':
exit_code = main()
--
1.8.3.1
--
Dodji