41 from diagnostic_msgs.msg
import DiagnosticArray
50 rospy.init_node(
'test_cpu_monitor')
52 if rospy.has_param(
'~expected_level'):
60 self._subscriber.unregister()
62 self.assertEqual(len(self._msg.status), 1)
63 status = self._msg.status[0]
65 for v
in status.values:
66 percentage = float(v.value)
67 self.assertGreaterEqual(percentage, 0)
68 self.assertLessEqual(percentage, 100)
74 PKG =
'diagnostics_common_diagnostics' 75 NAME =
'test_cpu_monitor' 76 if __name__ ==
'__main__':
77 rostest.unitrun(PKG, NAME, TestCPUMonitor)
def diagnostics_callback(self, msg)
def test_cpu_monitor_diagnostics(self)