def test_PortageInstaller():
    if not is_gentoo():
        print("Skipping not Gentoo")
        return 

    from rosdep2.platforms.gentoo import PortageInstaller

    @patch.object(PortageInstaller, 'get_packages_to_install')
    def test(mock_method):
        installer = PortageInstaller()
        mock_method.return_value = []
        assert [] == installer.get_install_command(['fake'])

        mock_method.return_value = ['a', 'b']
        
        expected = [['sudo', '-H', 'emerge', 'a'],
                    ['sudo', '-H', 'emerge', 'b']]
        val = installer.get_install_command(['whatever'], interactive=False)
        assert val == expected, val

        expected = [['sudo', '-H', 'emerge', '-a', 'a'],
                    ['sudo', '-H', 'emerge', '-a', 'b']]
        val = installer.get_install_command(['whatever'], interactive=True)
        assert val == expected, val
        
    try:
        test()
    except __HOLE__:
        traceback.print_exc()
        raise
dataset/ETHPy150Open ros-infrastructure/rosdep/test/test_rosdep_gentoo.py/test_PortageInstaller