示例#1
0
 def test_cmd_remove(self):
     # rosinstall to create dir
     self.local_path = os.path.join(self.test_root_path, "ws12")
     cli = RoswsCLI()
     self.assertEqual(0, cli.cmd_init([self.local_path, self.ros_path]))
     self.assertEqual(0, cli.cmd_merge(self.local_path, [self.git_path, "-y"]))
     self.assertEqual(0, cli.cmd_merge(self.local_path, [self.hg_path, "-y"]))
     config = rosinstall.multiproject_cmd.get_config(basepath=self.local_path,
                                                     config_filename='.rosinstall')
     self.assertEqual(len(config.get_config_elements()), 3)
     self.assertEqual(0, cli.cmd_remove(self.local_path, [self.git_path]))
     config = rosinstall.multiproject_cmd.get_config(basepath=self.local_path,
                                                     config_filename='.rosinstall')
     self.assertEqual(len(config.get_config_elements()), 2)
示例#2
0
 def test_cmd_remove(self):
     # rosinstall to create dir
     self.local_path = os.path.join(self.test_root_path, "ws12")
     cli = RoswsCLI()
     self.assertEqual(0, cli.cmd_init([self.local_path, self.ros_path]))
     self.assertEqual(0,
                      cli.cmd_merge(self.local_path, [self.git_path, "-y"]))
     self.assertEqual(0, cli.cmd_merge(self.local_path,
                                       [self.hg_path, "-y"]))
     config = rosinstall.multiproject_cmd.get_config(
         basepath=self.local_path, config_filename='.rosinstall')
     self.assertEqual(len(config.get_config_elements()), 3)
     self.assertEqual(0, cli.cmd_remove(self.local_path, [self.git_path]))
     config = rosinstall.multiproject_cmd.get_config(
         basepath=self.local_path, config_filename='.rosinstall')
     self.assertEqual(len(config.get_config_elements()), 2)
示例#3
0
 def test_remove(self):
     workspace = os.path.join(self.test_root_path, 'ws3')
     cli = RoswsCLI()
     self.assertEqual(0, cli.cmd_init([workspace, self.simple_rosinstall]))
     self.assertEqual(0, cli.cmd_merge(workspace, [self.simple_changed_vcs_rosinstall, '-y']))
     self.assertEqual(0, cli.cmd_update(workspace, []))
     config = rosinstall.multiproject_cmd.get_config(workspace, config_filename='.rosinstall')
     self.assertEqual(3, len(config.get_config_elements()))
     self.assertEqual(0, cli.cmd_remove(workspace, ['hgrepo']))
     config = rosinstall.multiproject_cmd.get_config(workspace, config_filename='.rosinstall')
     self.assertEqual(2, len(config.get_config_elements()))
示例#4
0
 def test_merge(self):
     workspace = os.path.join(self.test_root_path, 'ws2')
     cli = RoswsCLI()
     self.assertEqual(0, cli.cmd_init([workspace, self.simple_rosinstall]))
     self.assertEqual(0, cli.cmd_merge(workspace, [self.simple_changed_vcs_rosinstall, '-y']))
     self.assertFalse(os.path.isdir(os.path.join(workspace, 'hgrepo')))
     self.assertFalse(os.path.isdir(os.path.join(workspace, 'hgrepo', '.hg')))
     self.assertEqual(0, cli.cmd_update(workspace, []))
     self.assertTrue(os.path.isdir(os.path.join(workspace, 'hgrepo')))
     self.assertTrue(os.path.isdir(os.path.join(workspace, 'hgrepo', '.hg')))
     config = wstool.multiproject_cmd.get_config(workspace, config_filename='.rosinstall')
     self.assertEqual(3, len(config.get_config_elements()))
示例#5
0
    def test_cmd_init(self):
        self.local_path = os.path.join(self.test_root_path, "ws5")
        os.makedirs(self.local_path)

        cli = RoswsCLI()
        self.assertEqual(0, cli.cmd_init([self.local_path, self.ros_path]))
        self.assertTrue(
            os.path.exists(os.path.join(self.local_path, 'setup.sh')))
        self.assertTrue(
            os.path.exists(os.path.join(self.local_path, 'setup.bash')))
        self.assertTrue(
            os.path.exists(os.path.join(self.local_path, 'setup.zsh')))
        self.assertTrue(
            os.path.exists(os.path.join(self.local_path, '.rosinstall')))
        self.assertEqual(
            0,
            subprocess.call(". %s" % os.path.join(self.local_path, 'setup.sh'),
                            shell=True,
                            env=self.new_environ))
        self.assertEqual(
            0,
            subprocess.call(". %s" %
                            os.path.join(self.local_path, 'setup.bash'),
                            shell=True,
                            env=self.new_environ,
                            executable='/bin/bash'))

        self.assertEqual(0,
                         cli.cmd_merge(self.local_path, [self.ros_path, "-y"]))
        self.assertTrue(
            os.path.exists(os.path.join(self.local_path, 'setup.sh')))
        self.assertTrue(
            os.path.exists(os.path.join(self.local_path, 'setup.bash')))
        self.assertTrue(
            os.path.exists(os.path.join(self.local_path, 'setup.zsh')))
        self.assertTrue(
            os.path.exists(os.path.join(self.local_path, '.rosinstall')))
        self.assertEqual(
            0,
            subprocess.call(". %s" % os.path.join(self.local_path, 'setup.sh'),
                            shell=True,
                            env=self.new_environ))
        self.assertEqual(
            0,
            subprocess.call(". %s" %
                            os.path.join(self.local_path, 'setup.bash'),
                            shell=True,
                            env=self.new_environ,
                            executable='/bin/bash'))
示例#6
0
 def test_set_detached(self):
     workspace = os.path.join(self.test_root_path, 'ws4')
     cli = RoswsCLI()
     self.assertEqual(0, cli.cmd_init([workspace, self.simple_rosinstall]))
     self.assertEqual(0, cli.cmd_merge(workspace, [self.simple_changed_vcs_rosinstall, '-y']))
     self.assertEqual(0, cli.cmd_update(workspace, []))
     config = rosinstall.multiproject_cmd.get_config(workspace, config_filename='.rosinstall')
     self.assertEqual(3, len(config.get_config_elements()))
     self.assertEqual('ros', config.get_config_elements()[0].get_local_name())
     self.assertEqual('gitrepo', config.get_config_elements()[1].get_local_name())
     self.assertEqual(True, config.get_config_elements()[1].is_vcs_element())
     self.assertEqual('hgrepo', config.get_config_elements()[2].get_local_name())
     self.assertEqual(0, cli.cmd_set(workspace, [os.path.join(workspace, 'gitrepo'), '--detached', '-y']))
     config = rosinstall.multiproject_cmd.get_config(workspace, config_filename='.rosinstall')
     self.assertEqual(3, len(config.get_config_elements()))
     self.assertEqual('ros', config.get_config_elements()[0].get_local_name())
     self.assertEqual('gitrepo', config.get_config_elements()[1].get_local_name())
     self.assertEqual(False, config.get_config_elements()[1].is_vcs_element())
     self.assertEqual('hgrepo', config.get_config_elements()[2].get_local_name())
示例#7
0
    def test_cmd_init(self):
        self.local_path = os.path.join(self.test_root_path, "ws5")
        os.makedirs(self.local_path)

        cli = RoswsCLI()
        self.assertEqual(0, cli.cmd_init([self.local_path, self.ros_path]))
        self.assertTrue(os.path.exists(os.path.join(self.local_path, 'setup.sh')))
        self.assertTrue(os.path.exists(os.path.join(self.local_path, 'setup.bash')))
        self.assertTrue(os.path.exists(os.path.join(self.local_path, 'setup.zsh')))
        self.assertTrue(os.path.exists(os.path.join(self.local_path, '.rosinstall')))
        self.assertEqual(0, subprocess.call(". %s" % os.path.join(self.local_path, 'setup.sh'), shell=True, env=self.new_environ))
        self.assertEqual(0, subprocess.call(". %s" % os.path.join(self.local_path, 'setup.bash'), shell=True, env=self.new_environ, executable='/bin/bash'))

        self.assertEqual(0, cli.cmd_merge(self.local_path, [self.ros_path, "-y"]))
        self.assertTrue(os.path.exists(os.path.join(self.local_path, 'setup.sh')))
        self.assertTrue(os.path.exists(os.path.join(self.local_path, 'setup.bash')))
        self.assertTrue(os.path.exists(os.path.join(self.local_path, 'setup.zsh')))
        self.assertTrue(os.path.exists(os.path.join(self.local_path, '.rosinstall')))
        self.assertEqual(0, subprocess.call(". %s" % os.path.join(self.local_path, 'setup.sh'), shell=True, env=self.new_environ))
        self.assertEqual(0, subprocess.call(". %s" % os.path.join(self.local_path, 'setup.bash'), shell=True, env=self.new_environ, executable='/bin/bash'))