Пример #1
0
 def test_raise_valueerror_if_nan(self):
     with collectdlib.run_server() as server:
         with collectd.Client(server.path) as client:
             self.assertRaises(
                 ValueError,
                 client.get,
                 'success/value=NaN',
             )
Пример #2
0
 def test_get_not_existent_value(self):
     with collectdlib.run_server() as server:
         with collectd.Client(server.path) as client:
             self.assertRaises(collectd.Error, client.get, 'missing/foobar')
Пример #3
0
 def test_get_error(self):
     with collectdlib.run_server() as server:
         with collectd.Client(server.path) as client:
             self.assertRaises(collectd.Error, client.get, 'error/error')
Пример #4
0
 def test_get_value_nan(self):
     with collectdlib.run_server() as server:
         with collectd.Client(server.path) as client:
             x = client.get('success/value=NaN', raise_if_nan=False)
             self.assertTrue(math.isnan(x[0]))
Пример #5
0
 def test_get_value(self, key, value):
     with collectdlib.run_server() as server:
         with collectd.Client(server.path) as client:
             x = client.get('success/{key}'.format(key=key))
             self.assertEqual(x, value)
Пример #6
0
 def test_list_without_open(self, method, args):
     with collectdlib.run_server() as server:
         client = collectd.Client(server.path)
         self.assertRaises(collectd.NotConnected, getattr(client, method),
                           *args)
         server.stop()  # ensure cleanup