from std_msgs.msg import Int32

import pyrostest

class TestAddOne(pyrostest.RosTest):
    @pyrostest.launch_node('pyrostest', 'add_one.py')
    def test_add_one_node_single(self):
        with self.mock_pub('/pub_val', Int32, queue_size=0) as sub:
            with self.check_topic('/pyrostest/add_one', Int32) as out:
                sub.send(Int32(5))
                assert out.message.data == 6

    @pyrostest.launch_node('pyrostest', 'add_one.py')
    def test_add_one_node_many(self):
        with self.mock_pub('/pub_val', Int32, queue_size=0) as sub:
            with self.check_topic('/pyrostest/add_one', Int32) as out:
                sub.send(Int32(5))
                assert out.message.data == 6
            with self.check_topic('/pyrostest/add_one', Int32) as out2:
                sub.send(Int32(7))
                assert out2.message.data == 8


class TestPubFoo(pyrostest.RosTest):
    @pyrostest.with_launch_file('pyrostest', 'launch.launch')
    @pyrostest.launch_node('pyrostest', 'pub_foo.py')
    def test_foo_node(self):
        with self.check_topic('/pub_val', Int32) as out:
            assert out.message.data == 7


class TestSequence(pyrostest.RosTest):
    @pyrostest.with_launch_file('pyrostest', 'launch.launch')
    @pyrostest.launch_node('pyrostest', 'pub_foo.py')
    @pyrostest.launch_node('pyrostest', 'add_one.py')
    def test_nodes_in_sequence(self):
        with self.check_topic('/pyrostest/add_one', Int32) as out:
            assert out.message.data == 8

@@ -859,16 +859,262 @@
 a == 8%0A%0A
+    @pyrostest.launch_node('pyrostest', 'add_one.py')%0A    def test_unused_node(self):%0A        with self.mock_pub('/pub_val', Int32, queue_size=0) as sub:%0A            with self.check_topic('/pyrostest/add_one', Int32) as out:%0A                pass%0A
 %0Aclass T
@@ -1387,17 +1387,16 @@
 a == 7%0A%0A
-%0A
 class Te

Add a test for an unusued node.