#1355 Do not build package module-build-macros for tests in test_build.py
Closed 4 years ago by cqi. Opened 4 years ago by cqi.

@@ -357,6 +357,28 @@ 

  

  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 [],

Signed-off-by: Chenxiong Qi cqi@redhat.com

What's the main reason to do it here? To remove the rpmbuild dependency?

rebased onto 4ba6954

4 years ago

@jkaluza Fixed that typo. Regarding the removal, I found out the built module-build-macros SRPM is not used in those tests, and this change could make tests run faster.

@cqi, I've tested this and for me it makes the tests 10 seconds slower, not sure why :(. Can you try yourself with and without your patch and check the results?

@jkaluza Interesting. Not sure why as well. However, I suspect it could probably because of the virtual machine I'm using and run tests inside. I test it again with and without this patch, there is no significant difference this time. rpmbuild -bs is fast enough. Seems this patch is useless. I'm going to close it.

Pull-Request has been closed by cqi

4 years ago