ros_comm icon indicating copy to clipboard operation
ros_comm copied to clipboard

rospy.core.is_initialized() is False after rospy.init_node()

Open kosei1515 opened this issue 2 years ago • 0 comments

I found that after rospy.init_node(), rospy.core.is_initialized() still returns False. However, in the function rospy.init_node, there is the process of rospy.core.set_initialized(True) here I'm not sure why this problem is happening. Please use the following test code to check this error.

from mock import patch
from nose.tools import eq_
import rospy

@patch('rospy.init_node')
def test_rospy_core_is_initialized(init_mock):
    """Test rospy.core.is_initialized()"""    
    eq_(rospy.core.is_initialized(), False)    
    rospy.init_node("test_node")
    eq_(rospy.core.is_initialized(), True)

kosei1515 avatar Jun 29 '23 11:06 kosei1515