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', )
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')
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')
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]))
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)
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