Hi @swarooph.nirmal,
I tried to find an answer for this, but it seems that during tests the log messages are not really sent to /rosout
.
I created a ros test file to test the concept, and the messages are never received on /rosout
.
This is the test I used:
#! /usr/bin/env python
from rosgraph_msgs.msg import Log
import rospy
import unittest
import rostest
def callback(data):
rospy.logfatal('I am the fatal and received: %s' % data)
class MyTestCase(unittest.TestCase):
def test_whatever(self):
rospy.init_node('subscriber_node', anonymous=True)
rospy.Subscriber("/rosout", Log, callback)
rospy.logwarn('Sleeping 10 seconds to see whether test goes ok')
from time import sleep
count = 1
while True:
count +=1
rospy.logwarn('I am the legend %d' % count)
if count == 5: break
sleep(2)
rospy.logwarn('Finishing')
if __name__ == "__main__":
rostest.rosrun('diagnostics', 'diagnostics_test_node', MyTestCase)
With the code above I see the logwarn is printed to screen, but the logfatal is never printed.
So what I can say is, from this test, it seems that during tests the log messages are not really sent to /rosout.