From 4ba69543115f1b87d31987d8a6a0ae96e587cc22 Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Jul 22 2019 15:10:13 +0000 Subject: Do not build package module-build-macros for tests in test_build.py Signed-off-by: Chenxiong Qi --- diff --git a/tests/test_build/test_build.py b/tests/test_build/test_build.py index b1c2066..1648d9f 100644 --- a/tests/test_build/test_build.py +++ b/tests/test_build/test_build.py @@ -357,6 +357,28 @@ def cleanup_moksha(): class BaseTestBuild: + @classmethod + def setup_class(cls): + # Do not really build module-build-macros SRPM + # get_disttag_rpm builds package module-build-macros by `rpmbuild -bs' + # and return the path of result SRPM. + + cls.p_Popen = patch("subprocess.Popen") + cls.mock_Popen = cls.p_Popen.start() + cls.mock_Popen.return_value.returncode = 0 + cls.mock_Popen.return_value.communicate.return_value = ('', '') + + # Let get_disttag_rpm return a fake SRPM path + cls.p_glob = patch( + "glob.glob", + return_value=["/tmp/module-build/module-build-macros.src.rpm"]) + cls.mock_glob = cls.p_glob.start() + + @classmethod + def teardown_class(cls): + cls.p_glob.stop() + cls.p_Popen.stop() + def run_scheduler(self, db_session, msgs=None, stop_condition=None): module_build_service.scheduler.main( msgs or [],