Main Page
Namespaces
Classes
Files
File List
File Members
test
test_nodelet_exists.py
Go to the documentation of this file.
1
#! /usr/bin/env python
2
3
import
rospy
4
import
rostest
5
from
std_msgs.msg
import
Int32
6
import
sys
7
from
time
import
sleep
8
import
unittest
9
10
PKG =
'swri_nodelet'
11
NAME =
'test_nodelet_exists'
12
13
class
TestNodeletExists
(unittest.TestCase):
14
15
def
callback
(self, msg):
16
self.
msg
= msg
17
18
def
test_init
(self):
19
'''
20
Test that the test nodelet exists by waiting for the message it
21
publishes.
22
'''
23
self.
msg
=
None
24
sub = rospy.Subscriber(
'numbers'
, Int32, self.
callback
)
25
while
self.
msg
is
None
:
26
sleep(0.1)
27
sub.unregister()
28
self.assertEquals(self.msg.data, 1337)
29
30
if
__name__ ==
'__main__'
:
31
rospy.init_node(NAME)
32
rostest.rosrun(PKG, NAME, TestNodeletExists, sys.argv)
test_nodelet_exists.TestNodeletExists.msg
msg
Definition:
test_nodelet_exists.py:16
test_nodelet_exists.TestNodeletExists.callback
def callback(self, msg)
Definition:
test_nodelet_exists.py:15
test_nodelet_exists.TestNodeletExists.test_init
def test_init(self)
Definition:
test_nodelet_exists.py:18
test_nodelet_exists.TestNodeletExists
Definition:
test_nodelet_exists.py:13
swri_nodelet
Author(s):
autogenerated on Fri Jun 7 2019 22:05:45