Ejemplo n.º 1
0
 def test_cmd_remove(self):
     # rosinstall to create dir
     self.local_path = os.path.join(self.test_root_path, "ws32")
     cli = MultiprojectCLI(progname='multi_cli',
                           config_filename='.rosinstall',
                           allow_other_element=False)
     self.assertEqual(0, cli.cmd_init([self.local_path]))
     self.assertRaises(MultiProjectException, cli.cmd_merge,
                       self.local_path, [self.git_path, "-y"])
     self.assertRaises(MultiProjectException, cli.cmd_merge,
                       self.local_path, [self.hg_path, "-y"])
     cli = MultiprojectCLI(progname='multi_cli',
                           config_filename='.rosinstall',
                           allow_other_element=True)
     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()), 2)
     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()), 1)
Ejemplo n.º 2
0
 def test_cmd_remove(self):
     # rosinstall to create dir
     self.local_path = os.path.join(self.test_root_path, "ws32")
     cli = MultiprojectCLI(progname='multi_cli', config_filename='.rosinstall')
     self.assertEqual(0, cli.cmd_init([self.local_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()), 2)
     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()), 1)
Ejemplo n.º 3
0
 def test_init_parallel(self):
     self.local_path = os.path.join(self.test_root_path, "ws31")
     cli = MultiprojectCLI(progname='multi_cli',
                           config_filename='.rosinstall')
     self.assertEqual(
         0,
         cli.cmd_init(
             [self.local_path, self.simple_rosinstall, "--parallel=5"]))
     self.assertTrue(
         os.path.exists(os.path.join(self.local_path, '.rosinstall')))
     self.assertTrue(
         os.path.exists(os.path.join(self.local_path, 'gitrepo')))
     self.assertFalse(
         os.path.exists(os.path.join(self.local_path, 'hgrepo')))
     self.assertEqual(
         0,
         cli.cmd_merge(self.local_path,
                       [self.simple_changed_vcs_rosinstall, "-y"]))
     self.assertTrue(
         os.path.exists(os.path.join(self.local_path, 'gitrepo')))
     self.assertFalse(
         os.path.exists(os.path.join(self.local_path, 'hgrepo')))
     self.assertEqual(0, cli.cmd_update(self.local_path, ["--parallel=5"]))
     self.assertTrue(
         os.path.exists(os.path.join(self.local_path, 'gitrepo')))
     self.assertTrue(os.path.exists(os.path.join(self.local_path,
                                                 'hgrepo')))
Ejemplo n.º 4
0
    def test_merge_dash(self):
        self.local_path = os.path.join(self.test_root_path, "ws35")
        cli = MultiprojectCLI(progname='multi_cli',
                              config_filename='.rosinstall')
        self.assertEqual(
            0,
            cli.cmd_init(
                [self.local_path, self.simple_rosinstall, "--parallel=5"]))
        self.assertTrue(
            os.path.exists(os.path.join(self.local_path, '.rosinstall')))
        self.assertTrue(
            os.path.exists(os.path.join(self.local_path, 'gitrepo')))
        self.assertFalse(
            os.path.exists(os.path.join(self.local_path, 'hgrepo')))
        try:
            backup = sys.stdin
            with open(self.simple_changed_vcs_rosinstall, 'r') as fhand:
                contents = fhand.read()
            sys.stdin = Mock()
            sys.stdin.readlines.return_value = contents
            self.assertEqual(0, cli.cmd_merge(self.local_path, ["-"]))
        finally:
            sys.stdin = backup

        self.assertTrue(
            os.path.exists(os.path.join(self.local_path, 'gitrepo')))
        self.assertFalse(
            os.path.exists(os.path.join(self.local_path, 'hgrepo')))
        self.assertEqual(0, cli.cmd_update(self.local_path, ["--parallel=5"]))
        self.assertTrue(
            os.path.exists(os.path.join(self.local_path, 'gitrepo')))
        self.assertTrue(os.path.exists(os.path.join(self.local_path,
                                                    'hgrepo')))
Ejemplo n.º 5
0
 def test_init_parallel(self):
     self.local_path = os.path.join(self.test_root_path, "ws31")
     cli = MultiprojectCLI(progname='multi_cli', config_filename='.rosinstall')
     self.assertEqual(0, cli.cmd_init([self.local_path, self.simple_rosinstall, "--parallel=5"]))
     self.assertTrue(os.path.exists(os.path.join(self.local_path, '.rosinstall')))
     self.assertTrue(os.path.exists(os.path.join(self.local_path, 'gitrepo')))
     self.assertFalse(os.path.exists(os.path.join(self.local_path, 'hgrepo')))
     self.assertEqual(0, cli.cmd_merge(self.local_path, [self.simple_changed_vcs_rosinstall, "-y"]))
     self.assertTrue(os.path.exists(os.path.join(self.local_path, 'gitrepo')))
     self.assertFalse(os.path.exists(os.path.join(self.local_path, 'hgrepo')))
     self.assertEqual(0, cli.cmd_update(self.local_path, ["--parallel=5"]))
     self.assertTrue(os.path.exists(os.path.join(self.local_path, 'gitrepo')))
     self.assertTrue(os.path.exists(os.path.join(self.local_path, 'hgrepo')))
Ejemplo n.º 6
0
    def test_merge_dash(self):
        self.local_path = os.path.join(self.test_root_path, "ws35")
        cli = MultiprojectCLI(progname='multi_cli', config_filename='.rosinstall')
        self.assertEqual(0, cli.cmd_init([self.local_path, self.simple_rosinstall, "--parallel=5"]))
        self.assertTrue(os.path.exists(os.path.join(self.local_path, '.rosinstall')))
        self.assertTrue(os.path.exists(os.path.join(self.local_path, 'gitrepo')))
        self.assertFalse(os.path.exists(os.path.join(self.local_path, 'hgrepo')))
        try:
            backup = sys.stdin
            with open(self.simple_changed_vcs_rosinstall, 'r') as fhand:
                contents = fhand.read()
            sys.stdin = Mock()
            sys.stdin.readlines.return_value = contents
            self.assertEqual(0, cli.cmd_merge(self.local_path, ["-"]))
        finally:
            sys.stdin = backup

        self.assertTrue(os.path.exists(os.path.join(self.local_path, 'gitrepo')))
        self.assertFalse(os.path.exists(os.path.join(self.local_path, 'hgrepo')))
        self.assertEqual(0, cli.cmd_update(self.local_path, ["--parallel=5"]))
        self.assertTrue(os.path.exists(os.path.join(self.local_path, 'gitrepo')))
        self.assertTrue(os.path.exists(os.path.join(self.local_path, 'hgrepo')))