#582 Fix tests on EPEL 9/10.
Merged by onosek. Opened by romaingeissler1a.
romaingeissler1a/fedpkg master  into  master

Download 582.patch

Indeed in EPEL distro.like() returns "rhel fedora" while on fedora it returns an empty string.

When building on EL 9 or 10 today, you get these 3 errors:

__________ TestDetermineRuntimeEnv.test_return_None_if_os_is_unknown ___________
self = <test_commands.TestDetermineRuntimeEnv testMethod=test_return_None_if_os_is_unknown>
mock_id = <MagicMock name='id' id='139953078470464'>
    @patch('distro.id', return_value='')
    def test_return_None_if_os_is_unknown(self, mock_id):
>       self.assertEqual(None, self.cmd._determine_runtime_env())
E       AssertionError: None != 'el10'
test/test_commands.py:34: AssertionError
______________ TestDetermineRuntimeEnv.test_return_fedora_disttag ______________
self = <test_commands.TestDetermineRuntimeEnv testMethod=test_return_fedora_disttag>
mock_ver = <MagicMock name='major_version' id='139953077217488'>
mock_id = <MagicMock name='id' id='139953077476656'>
    @patch('distro.id', return_value='fedora')
    @patch('distro.major_version', return_value='25')
    def test_return_fedora_disttag(self, mock_ver, mock_id):
        result = self.cmd._determine_runtime_env()
>       self.assertEqual('fc25', result)
E       AssertionError: 'fc25' != 'el25'
E       - fc25
E       + el25
_________________ TestDetermineRuntimeEnv.test_return_for_eln __________________
self = <test_commands.TestDetermineRuntimeEnv testMethod=test_return_for_eln>
mock_koji = <PropertyMock name='kojisession' id='139953077481408'>
mock_ver = <MagicMock name='major_version' id='139953077473968'>
mock_id = <MagicMock name='id' id='139953076565104'>
mock_info = <MagicMock name='os_release_info' id='139953076564000'>
    @patch('distro.os_release_info', return_value={'variant': 'ELN'})
    @patch('distro.id', return_value='fedora')
    @patch('distro.major_version', return_value='41')
    @patch('pyrpkg.Commands.kojisession', new_callable=PropertyMock)
    def test_return_for_eln(self, mock_koji, mock_ver, mock_id, mock_info):
        self.cmd._kojisession = Mock()
        koji_session = mock_koji.return_value
        koji_session.getBuildConfig.return_value = {
            # minimal subset of the real koji response
            'extra': {
                'rpm.macro.eln': '128',
            },
        }
        result = self.cmd._determine_runtime_env()
>       self.assertEqual('eln128', result)
E       AssertionError: 'eln128' != 'el41'
E       - eln128
E       + el41

pretty please pagure-ci rebuild

pretty please pagure-ci rebuild

Hi, thanks for fixing that, @romaingeissler1a
First, I had to deal with failing py36 - 0db445b. Now unit tests are passing.

rebased onto 985e42039a399846a54a41aecd637d128197ba7f

Pull-Request has been merged by onosek

Metadata