コード例 #1
0
    def test_install_launcher(self):
        j = segway_upstart.Job(name="bar")
        j.add('segway_upstart', 'test/launch/a.launch')
        j.install(sudo=None, root=self.root_dir)

        self.assertTrue(os.path.exists(self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "bar.d/a.launch")),
                        "Launch file not copied.")
        self.assertFalse(os.path.exists(self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "bar.d/b.launch")),
                         "Launch copied which shouldn't have been.")
コード例 #2
0
    def test_install_glob(self):
        j = segway_upstart.Job(name="baz")
        j.add('segway_upstart', glob='test/launch/*.launch')
        j.install(sudo=None, root=self.root_dir)

        self.assertTrue(os.path.exists(self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "baz.d/a.launch")),
                        "Launch file not copied.")
        self.assertTrue(os.path.exists(self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "baz.d/b.launch")),
                        "Launch file not copied.")
コード例 #3
0
    def test_uninstall_user_file(self):
        j = segway_upstart.Job(name="goo")
        j.add('segway_upstart', glob='test/launch/*.launch')
        j.install(sudo=None, root=self.root_dir)
        with open(self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "goo.d/c.launch"), "w") as f:
            f.write("<launch></launch>")
        j.uninstall(sudo=None, root=self.root_dir)

        self.assertTrue(os.path.exists(self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "goo.d/c.launch")),
                        "User launch file wrongly removed.")
コード例 #4
0
    def test_uninstall(self):
        j = segway_upstart.Job(name="boo")
        j.add('segway_upstart', glob='test/launch/*.launch')
        j.install(sudo=None, root=self.root_dir)
        j.uninstall(sudo=None, root=self.root_dir)

        self.assertFalse(os.path.exists(self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "boo.d")),
                         "Job dir not removed.")
        self.assertFalse(os.path.exists(self.pjoin("etc/ros", os.getenv("ROS_DISTRO"), "usr/sbin/foo-start")),
                         "Start script not removed.")
コード例 #5
0
    def test_install(self):
        j = segway_upstart.Job(name="foo")
        j.install(sudo=None, root=self.root_dir)

        self.assertTrue(os.path.exists(self.pjoin("usr/sbin/foo-start")), "Start script not created.")
        self.assertTrue(os.path.exists(self.pjoin("usr/sbin/foo-stop")), "Stop script not created.")
        self.assertTrue(os.path.exists(self.pjoin("etc/init/foo.conf")), "Upstart configuration file not created.")

        self.assertEqual(0, subprocess.call(["bash", "-n", self.pjoin("usr/sbin/foo-start")]),
                         "Start script not valid bash syntax.")
        self.assertEqual(0, subprocess.call(["bash", "-n", self.pjoin("usr/sbin/foo-stop")]),
                         "Stop script not valid bash syntax.")