Fix silent failure of tests/runtestfedabipkgdiff.py

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>
This commit is contained in:
Dodji Seketeli 2017-01-24 00:37:22 +01:00
parent 2d828b3b32
commit 838aa6810b
2 changed files with 3 additions and 4 deletions

View File

@ -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):

View File

@ -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()