def test_PacmanInstaller():
    from rosdep2.platforms.arch import PacmanInstaller

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

        # no interactive option implemented yet
        mock_method.return_value = ['a', 'b']
        expected = [['sudo', '-H', 'pacman', '-Sy', '--needed', 'a'],
                    ['sudo', '-H', 'pacman', '-Sy', '--needed', 'b']]
        val = installer.get_install_command(['whatever'], interactive=False)
        assert val == expected, val
        expected = [['sudo', '-H', 'pacman', '-Sy', '--needed', 'a'],
                    ['sudo', '-H', 'pacman', '-Sy', '--needed', '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_arch.py/test_PacmanInstaller