1diff --git a/influxdb/tests/client_test.py b/influxdb/tests/client_test.py
2index 115fbc4..5b348c7 100644
3--- a/influxdb/tests/client_test.py
4+++ b/influxdb/tests/client_test.py
5@@ -32,7 +32,6 @@ import requests
6 import requests.exceptions
7 import requests_mock
8
9-from nose.tools import raises
10 from urllib3.connection import HTTPConnection
11
12 from influxdb import InfluxDBClient
13@@ -383,12 +382,12 @@ class TestInfluxDBClient(unittest.TestCase):
14 received_data.decode()
15 )
16
17- @raises(Exception)
18 def test_write_points_fails(self):
19 """Test write points fail for TestInfluxDBClient object."""
20 cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
21- with _mocked_session(cli, 'post', 500):
22- cli.write_points([])
23+ with self.assertRaises(Exception):
24+ with _mocked_session(cli, 'post', 500):
25+ cli.write_points([])
26
27 def test_write_points_with_precision(self):
28 """Test write points with precision for TestInfluxDBClient object."""
29@@ -541,12 +540,12 @@ class TestInfluxDBClient(unittest.TestCase):
30 consistency='boo'
31 )
32
33- @raises(Exception)
34 def test_write_points_with_precision_fails(self):
35 """Test write points w/precision fail for TestInfluxDBClient object."""
36 cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
37- with _mocked_session(cli, 'post', 500):
38- cli.write_points_with_precision([])
39+ with self.assertRaises(Exception):
40+ with _mocked_session(cli, 'post', 500):
41+ cli.write_points_with_precision([])
42
43 def test_query(self):
44 """Test query method for TestInfluxDBClient object."""
45@@ -651,11 +650,11 @@ class TestInfluxDBClient(unittest.TestCase):
46 [example_object, example_object]
47 )
48
49- @raises(Exception)
50 def test_query_fail(self):
51 """Test query failed for TestInfluxDBClient object."""
52- with _mocked_session(self.cli, 'get', 401):
53- self.cli.query('select column_one from foo;')
54+ with self.assertRaises(Exception):
55+ with _mocked_session(self.cli, 'get', 401):
56+ self.cli.query('select column_one from foo;')
57
58 def test_ping(self):
59 """Test ping querying InfluxDB version."""
60@@ -697,11 +696,11 @@ class TestInfluxDBClient(unittest.TestCase):
61 'create database "123"'
62 )
63
64- @raises(Exception)
65 def test_create_database_fails(self):
66 """Test create database fail for TestInfluxDBClient object."""
67- with _mocked_session(self.cli, 'post', 401):
68- self.cli.create_database('new_db')
69+ with self.assertRaises(Exception):
70+ with _mocked_session(self.cli, 'post', 401):
71+ self.cli.create_database('new_db')
72
73 def test_drop_database(self):
74 """Test drop database for TestInfluxDBClient object."""
75@@ -762,12 +761,12 @@ class TestInfluxDBClient(unittest.TestCase):
76 [{'name': 'new_db_1'}, {'name': 'new_db_2'}]
77 )
78
79- @raises(Exception)
80 def test_get_list_database_fails(self):
81 """Test get list of dbs fail for TestInfluxDBClient object."""
82 cli = InfluxDBClient('host', 8086, 'username', 'password')
83- with _mocked_session(cli, 'get', 401):
84- cli.get_list_database()
85+ with self.assertRaises(Exception):
86+ with _mocked_session(cli, 'get', 401):
87+ cli.get_list_database()
88
89 def test_get_list_measurements(self):
90 """Test get list of measurements for TestInfluxDBClient object."""
91@@ -840,12 +839,12 @@ class TestInfluxDBClient(unittest.TestCase):
92 self.cli.get_list_series(tags={'region': 'us-west'}),
93 ['cpu_load_short,host=server01,region=us-west'])
94
95- @raises(Exception)
96 def test_get_list_series_fails(self):
97 """Test get a list of series from the database but fail."""
98 cli = InfluxDBClient('host', 8086, 'username', 'password')
99- with _mocked_session(cli, 'get', 401):
100- cli.get_list_series()
101+ with self.assertRaises(Exception):
102+ with _mocked_session(cli, 'get', 401):
103+ cli.get_list_series()
104
105 def test_create_retention_policy_default(self):
106 """Test create default ret policy for TestInfluxDBClient object."""
107@@ -971,12 +970,12 @@ class TestInfluxDBClient(unittest.TestCase):
108 'alter retention policy "somename" on "db" default'
109 )
110
111- @raises(Exception)
112 def test_alter_retention_policy_invalid(self):
113 """Test invalid alter ret policy for TestInfluxDBClient object."""
114 cli = InfluxDBClient('host', 8086, 'username', 'password')
115- with _mocked_session(cli, 'get', 400):
116- self.cli.alter_retention_policy('somename', 'db')
117+ with self.assertRaises(Exception):
118+ with _mocked_session(cli, 'get', 400):
119+ self.cli.alter_retention_policy('somename', 'db')
120
121 def test_drop_retention_policy(self):
122 """Test drop retention policy for TestInfluxDBClient object."""
123@@ -994,12 +993,12 @@ class TestInfluxDBClient(unittest.TestCase):
124 'drop retention policy "somename" on "db"'
125 )
126
127- @raises(Exception)
128 def test_drop_retention_policy_fails(self):
129 """Test failed drop ret policy for TestInfluxDBClient object."""
130 cli = InfluxDBClient('host', 8086, 'username', 'password')
131- with _mocked_session(cli, 'delete', 401):
132- cli.drop_retention_policy('default', 'db')
133+ with self.assertRaises(Exception):
134+ with _mocked_session(cli, 'delete', 401):
135+ cli.drop_retention_policy('default', 'db')
136
137 def test_get_list_retention_policies(self):
138 """Test get retention policies for TestInfluxDBClient object."""
139@@ -1179,12 +1178,12 @@ class TestInfluxDBClient(unittest.TestCase):
140 'grant all privileges to "test"'
141 )
142
143- @raises(Exception)
144 def test_grant_admin_privileges_invalid(self):
145 """Test grant invalid admin privs for TestInfluxDBClient object."""
146 cli = InfluxDBClient('host', 8086, 'username', 'password')
147- with _mocked_session(cli, 'get', 400):
148- self.cli.grant_admin_privileges('')
149+ with self.assertRaises(Exception):
150+ with _mocked_session(cli, 'get', 400):
151+ self.cli.grant_admin_privileges('')
152
153 def test_revoke_admin_privileges(self):
154 """Test revoke admin privs for TestInfluxDBClient object."""
155@@ -1203,12 +1202,12 @@ class TestInfluxDBClient(unittest.TestCase):
156 'revoke all privileges from "test"'
157 )
158
159- @raises(Exception)
160 def test_revoke_admin_privileges_invalid(self):
161 """Test revoke invalid admin privs for TestInfluxDBClient object."""
162 cli = InfluxDBClient('host', 8086, 'username', 'password')
163- with _mocked_session(cli, 'get', 400):
164- self.cli.revoke_admin_privileges('')
165+ with self.assertRaises(Exception):
166+ with _mocked_session(cli, 'get', 400):
167+ self.cli.revoke_admin_privileges('')
168
169 def test_grant_privilege(self):
170 """Test grant privs for TestInfluxDBClient object."""
171@@ -1227,12 +1226,12 @@ class TestInfluxDBClient(unittest.TestCase):
172 'grant read on "testdb" to "test"'
173 )
174
175- @raises(Exception)
176 def test_grant_privilege_invalid(self):
177 """Test grant invalid privs for TestInfluxDBClient object."""
178 cli = InfluxDBClient('host', 8086, 'username', 'password')
179- with _mocked_session(cli, 'get', 400):
180- self.cli.grant_privilege('', 'testdb', 'test')
181+ with self.assertRaises(Exception):
182+ with _mocked_session(cli, 'get', 400):
183+ self.cli.grant_privilege('', 'testdb', 'test')
184
185 def test_revoke_privilege(self):
186 """Test revoke privs for TestInfluxDBClient object."""
187@@ -1251,12 +1250,12 @@ class TestInfluxDBClient(unittest.TestCase):
188 'revoke read on "testdb" from "test"'
189 )
190
191- @raises(Exception)
192 def test_revoke_privilege_invalid(self):
193 """Test revoke invalid privs for TestInfluxDBClient object."""
194 cli = InfluxDBClient('host', 8086, 'username', 'password')
195- with _mocked_session(cli, 'get', 400):
196- self.cli.revoke_privilege('', 'testdb', 'test')
197+ with self.assertRaises(Exception):
198+ with _mocked_session(cli, 'get', 400):
199+ self.cli.revoke_privilege('', 'testdb', 'test')
200
201 def test_get_list_privileges(self):
202 """Test get list of privs for TestInfluxDBClient object."""
203@@ -1278,12 +1277,12 @@ class TestInfluxDBClient(unittest.TestCase):
204 {'database': 'db3', 'privilege': 'NO PRIVILEGES'}]
205 )
206
207- @raises(Exception)
208 def test_get_list_privileges_fails(self):
209 """Test failed get list of privs for TestInfluxDBClient object."""
210 cli = InfluxDBClient('host', 8086, 'username', 'password')
211- with _mocked_session(cli, 'get', 401):
212- cli.get_list_privileges('test')
213+ with self.assertRaises(Exception):
214+ with _mocked_session(cli, 'get', 401):
215+ cli.get_list_privileges('test')
216
217 def test_get_list_continuous_queries(self):
218 """Test getting a list of continuous queries."""
219@@ -1333,11 +1332,11 @@ class TestInfluxDBClient(unittest.TestCase):
220 ]
221 )
222
223- @raises(Exception)
224 def test_get_list_continuous_queries_fails(self):
225 """Test failing to get a list of continuous queries."""
226- with _mocked_session(self.cli, 'get', 400):
227- self.cli.get_list_continuous_queries()
228+ with self.assertRaises(Exception):
229+ with _mocked_session(self.cli, 'get', 400):
230+ self.cli.get_list_continuous_queries()
231
232 def test_create_continuous_query(self):
233 """Test continuous query creation."""
234@@ -1366,11 +1365,12 @@ class TestInfluxDBClient(unittest.TestCase):
235 '"6_months"."events" from "events" group by time(10m) end'
236 )
237
238- @raises(Exception)
239 def test_create_continuous_query_fails(self):
240 """Test failing to create a continuous query."""
241- with _mocked_session(self.cli, 'get', 400):
242- self.cli.create_continuous_query('cq_name', 'select', 'db_name')
243+ with self.assertRaises(Exception):
244+ with _mocked_session(self.cli, 'get', 400):
245+ self.cli.create_continuous_query('cq_name', 'select',
246+ 'db_name')
247
248 def test_drop_continuous_query(self):
249 """Test dropping a continuous query."""
250@@ -1387,11 +1387,11 @@ class TestInfluxDBClient(unittest.TestCase):
251 'drop continuous query "cq_name" on "db_name"'
252 )
253
254- @raises(Exception)
255 def test_drop_continuous_query_fails(self):
256 """Test failing to drop a continuous query."""
257- with _mocked_session(self.cli, 'get', 400):
258- self.cli.drop_continuous_query('cq_name', 'db_name')
259+ with self.assertRaises(Exception):
260+ with _mocked_session(self.cli, 'get', 400):
261+ self.cli.drop_continuous_query('cq_name', 'db_name')
262
263 def test_invalid_port_fails(self):
264 """Test invalid port fail for TestInfluxDBClient object."""
265diff --git a/influxdb/tests/dataframe_client_test.py b/influxdb/tests/dataframe_client_test.py
266index 87b8e0d..a8c8416 100644
267--- a/influxdb/tests/dataframe_client_test.py
268+++ b/influxdb/tests/dataframe_client_test.py
269@@ -13,7 +13,6 @@ import unittest
270 import warnings
271 import requests_mock
272
273-from nose.tools import raises
274 from influxdb.tests import skip_if_pypy, using_pypy
275
276 from .client_test import _mocked_session
277@@ -597,35 +596,35 @@ class TestDataFrameClient(unittest.TestCase):
278 m.last_request.body,
279 )
280
281- @raises(TypeError)
282 def test_write_points_from_dataframe_fails_without_time_index(self):
283 """Test failed write points from df without time index."""
284 dataframe = pd.DataFrame(data=[["1", 1, 1.0], ["2", 2, 2.0]],
285 columns=["column_one", "column_two",
286 "column_three"])
287
288- with requests_mock.Mocker() as m:
289- m.register_uri(requests_mock.POST,
290- "http://localhost:8086/db/db/series",
291- status_code=204)
292+ with self.assertRaises(TypeError):
293+ with requests_mock.Mocker() as m:
294+ m.register_uri(requests_mock.POST,
295+ "http://localhost:8086/db/db/series",
296+ status_code=204)
297
298- cli = DataFrameClient(database='db')
299- cli.write_points(dataframe, "foo")
300+ cli = DataFrameClient(database='db')
301+ cli.write_points(dataframe, "foo")
302
303- @raises(TypeError)
304 def test_write_points_from_dataframe_fails_with_series(self):
305 """Test failed write points from df with series."""
306 now = pd.Timestamp('1970-01-01 00:00+00:00')
307 dataframe = pd.Series(data=[1.0, 2.0],
308 index=[now, now + timedelta(hours=1)])
309
310- with requests_mock.Mocker() as m:
311- m.register_uri(requests_mock.POST,
312- "http://localhost:8086/db/db/series",
313- status_code=204)
314+ with self.assertRaises(TypeError):
315+ with requests_mock.Mocker() as m:
316+ m.register_uri(requests_mock.POST,
317+ "http://localhost:8086/db/db/series",
318+ status_code=204)
319
320- cli = DataFrameClient(database='db')
321- cli.write_points(dataframe, "foo")
322+ cli = DataFrameClient(database='db')
323+ cli.write_points(dataframe, "foo")
324
325 def test_create_database(self):
326 """Test create database for TestInfluxDBClient object."""
327@@ -657,12 +656,12 @@ class TestDataFrameClient(unittest.TestCase):
328 'create database "123"'
329 )
330
331- @raises(Exception)
332 def test_create_database_fails(self):
333 """Test create database fail for TestInfluxDBClient object."""
334 cli = DataFrameClient(database='db')
335- with _mocked_session(cli, 'post', 401):
336- cli.create_database('new_db')
337+ with self.assertRaises(Exception):
338+ with _mocked_session(cli, 'post', 401):
339+ cli.create_database('new_db')
340
341 def test_drop_database(self):
342 """Test drop database for TestInfluxDBClient object."""
343@@ -709,12 +708,12 @@ class TestDataFrameClient(unittest.TestCase):
344 'drop database "123"'
345 )
346
347- @raises(Exception)
348 def test_get_list_database_fails(self):
349 """Test get list of dbs fail for TestInfluxDBClient object."""
350 cli = DataFrameClient('host', 8086, 'username', 'password')
351- with _mocked_session(cli, 'get', 401):
352- cli.get_list_database()
353+ with self.assertRaises(Exception):
354+ with _mocked_session(cli, 'get', 401):
355+ cli.get_list_database()
356
357 def test_get_list_measurements(self):
358 """Test get list of measurements for TestInfluxDBClient object."""
359@@ -819,12 +818,12 @@ class TestDataFrameClient(unittest.TestCase):
360 'alter retention policy "somename" on "db" default'
361 )
362
363- @raises(Exception)
364 def test_alter_retention_policy_invalid(self):
365 """Test invalid alter ret policy for TestInfluxDBClient object."""
366 cli = DataFrameClient('host', 8086, 'username', 'password')
367- with _mocked_session(cli, 'get', 400):
368- cli.alter_retention_policy('somename', 'db')
369+ with self.assertRaises(Exception):
370+ with _mocked_session(cli, 'get', 400):
371+ cli.alter_retention_policy('somename', 'db')
372
373 def test_drop_retention_policy(self):
374 """Test drop retention policy for TestInfluxDBClient object."""
375@@ -843,12 +842,12 @@ class TestDataFrameClient(unittest.TestCase):
376 'drop retention policy "somename" on "db"'
377 )
378
379- @raises(Exception)
380 def test_drop_retention_policy_fails(self):
381 """Test failed drop ret policy for TestInfluxDBClient object."""
382 cli = DataFrameClient('host', 8086, 'username', 'password')
383- with _mocked_session(cli, 'delete', 401):
384- cli.drop_retention_policy('default', 'db')
385+ with self.assertRaises(Exception):
386+ with _mocked_session(cli, 'delete', 401):
387+ cli.drop_retention_policy('default', 'db')
388
389 def test_get_list_retention_policies(self):
390 """Test get retention policies for TestInfluxDBClient object."""
391diff --git a/influxdb/tests/influxdb08/client_test.py b/influxdb/tests/influxdb08/client_test.py
392index 39ab52d..d20a411 100644
393--- a/influxdb/tests/influxdb08/client_test.py
394+++ b/influxdb/tests/influxdb08/client_test.py
395@@ -13,7 +13,6 @@ import requests
396 import requests.exceptions
397 import requests_mock
398
399-from nose.tools import raises
400 from mock import patch
401
402 from influxdb.influxdb08 import InfluxDBClient
403@@ -131,12 +130,12 @@ class TestInfluxDBClient(unittest.TestCase):
404 cli.switch_database('another_database')
405 self.assertEqual(cli._database, 'another_database')
406
407- @raises(FutureWarning)
408 def test_switch_db_deprecated(self):
409 """Test deprecated switch database for TestInfluxDBClient object."""
410 cli = InfluxDBClient('host', 8086, 'username', 'password', 'database')
411- cli.switch_db('another_database')
412- self.assertEqual(cli._database, 'another_database')
413+ with self.assertRaises(FutureWarning):
414+ cli.switch_db('another_database')
415+ self.assertEqual(cli._database, 'another_database')
416
417 def test_switch_user(self):
418 """Test switch user for TestInfluxDBClient object."""
419@@ -288,12 +287,13 @@ class TestInfluxDBClient(unittest.TestCase):
420 time_precision='ms'
421 )
422
423- @raises(Exception)
424 def test_write_points_fails(self):
425 """Test failed write points for TestInfluxDBClient object."""
426- with _mocked_session('post', 500):
427- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
428- cli.write_points([])
429+ with self.assertRaises(Exception):
430+ with _mocked_session('post', 500):
431+ cli = InfluxDBClient('host', 8086, 'username',
432+ 'password', 'db')
433+ cli.write_points([])
434
435 def test_write_points_with_precision(self):
436 """Test write points with precision."""
437@@ -313,12 +313,13 @@ class TestInfluxDBClient(unittest.TestCase):
438 time_precision='g'
439 )
440
441- @raises(Exception)
442 def test_write_points_with_precision_fails(self):
443 """Test write points where precision fails."""
444- with _mocked_session('post', 500):
445- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
446- cli.write_points_with_precision([])
447+ with self.assertRaises(Exception):
448+ with _mocked_session('post', 500):
449+ cli = InfluxDBClient('host', 8086, 'username',
450+ 'password', 'db')
451+ cli.write_points_with_precision([])
452
453 def test_delete_points(self):
454 """Test delete points for TestInfluxDBClient object."""
455@@ -333,30 +334,31 @@ class TestInfluxDBClient(unittest.TestCase):
456 {'u': 'username', 'p': 'password'})
457 self.assertEqual(kwds['url'], 'http://host:8086/db/db/series/foo')
458
459- @raises(Exception)
460 def test_delete_points_with_wrong_name(self):
461 """Test delete points with wrong name."""
462- with _mocked_session('delete', 400):
463- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
464- cli.delete_points("nonexist")
465+ with self.assertRaises(Exception):
466+ with _mocked_session('delete', 400):
467+ cli = InfluxDBClient('host', 8086, 'username',
468+ 'password', 'db')
469+ cli.delete_points("nonexist")
470
471- @raises(NotImplementedError)
472 def test_create_scheduled_delete(self):
473 """Test create scheduled deletes."""
474 cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
475- cli.create_scheduled_delete([])
476+ with self.assertRaises(NotImplementedError):
477+ cli.create_scheduled_delete([])
478
479- @raises(NotImplementedError)
480 def test_get_list_scheduled_delete(self):
481 """Test get schedule list of deletes TestInfluxDBClient."""
482 cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
483- cli.get_list_scheduled_delete()
484+ with self.assertRaises(NotImplementedError):
485+ cli.get_list_scheduled_delete()
486
487- @raises(NotImplementedError)
488 def test_remove_scheduled_delete(self):
489 """Test remove scheduled delete TestInfluxDBClient."""
490 cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
491- cli.remove_scheduled_delete(1)
492+ with self.assertRaises(NotImplementedError):
493+ cli.remove_scheduled_delete(1)
494
495 def test_query(self):
496 """Test query for TestInfluxDBClient object."""
497@@ -438,12 +440,13 @@ class TestInfluxDBClient(unittest.TestCase):
498 [example_object, example_object]
499 )
500
501- @raises(Exception)
502 def test_query_fail(self):
503 """Test failed query for TestInfluxDBClient."""
504- with _mocked_session('get', 401):
505- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
506- cli.query('select column_one from foo;')
507+ with self.assertRaises(Exception):
508+ with _mocked_session('get', 401):
509+ cli = InfluxDBClient('host', 8086, 'username',
510+ 'password', 'db')
511+ cli.query('select column_one from foo;')
512
513 def test_query_bad_precision(self):
514 """Test query with bad precision for TestInfluxDBClient."""
515@@ -460,12 +463,13 @@ class TestInfluxDBClient(unittest.TestCase):
516 cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
517 self.assertTrue(cli.create_database('new_db'))
518
519- @raises(Exception)
520 def test_create_database_fails(self):
521 """Test failed create database for TestInfluxDBClient."""
522- with _mocked_session('post', 401):
523- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
524- cli.create_database('new_db')
525+ with self.assertRaises(Exception):
526+ with _mocked_session('post', 401):
527+ cli = InfluxDBClient('host', 8086, 'username',
528+ 'password', 'db')
529+ cli.create_database('new_db')
530
531 def test_delete_database(self):
532 """Test delete database for TestInfluxDBClient."""
533@@ -473,12 +477,13 @@ class TestInfluxDBClient(unittest.TestCase):
534 cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
535 self.assertTrue(cli.delete_database('old_db'))
536
537- @raises(Exception)
538 def test_delete_database_fails(self):
539 """Test failed delete database for TestInfluxDBClient."""
540- with _mocked_session('delete', 401):
541- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
542- cli.delete_database('old_db')
543+ with self.assertRaises(Exception):
544+ with _mocked_session('delete', 401):
545+ cli = InfluxDBClient('host', 8086, 'username',
546+ 'password', 'db')
547+ cli.delete_database('old_db')
548
549 def test_get_list_database(self):
550 """Test get list of databases for TestInfluxDBClient."""
551@@ -490,23 +495,23 @@ class TestInfluxDBClient(unittest.TestCase):
552 self.assertEqual(len(cli.get_list_database()), 1)
553 self.assertEqual(cli.get_list_database()[0]['name'], 'a_db')
554
555- @raises(Exception)
556 def test_get_list_database_fails(self):
557 """Test failed get list of databases for TestInfluxDBClient."""
558- with _mocked_session('get', 401):
559- cli = InfluxDBClient('host', 8086, 'username', 'password')
560- cli.get_list_database()
561+ with self.assertRaises(Exception):
562+ with _mocked_session('get', 401):
563+ cli = InfluxDBClient('host', 8086, 'username', 'password')
564+ cli.get_list_database()
565
566- @raises(FutureWarning)
567 def test_get_database_list_deprecated(self):
568 """Test deprecated get database list for TestInfluxDBClient."""
569 data = [
570 {"name": "a_db"}
571 ]
572- with _mocked_session('get', 200, data):
573- cli = InfluxDBClient('host', 8086, 'username', 'password')
574- self.assertEqual(len(cli.get_database_list()), 1)
575- self.assertEqual(cli.get_database_list()[0]['name'], 'a_db')
576+ with self.assertRaises(FutureWarning):
577+ with _mocked_session('get', 200, data):
578+ cli = InfluxDBClient('host', 8086, 'username', 'password')
579+ self.assertEqual(len(cli.get_database_list()), 1)
580+ self.assertEqual(cli.get_database_list()[0]['name'], 'a_db')
581
582 def test_delete_series(self):
583 """Test delete series for TestInfluxDBClient."""
584@@ -514,12 +519,13 @@ class TestInfluxDBClient(unittest.TestCase):
585 cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
586 cli.delete_series('old_series')
587
588- @raises(Exception)
589 def test_delete_series_fails(self):
590 """Test failed delete series for TestInfluxDBClient."""
591- with _mocked_session('delete', 401):
592- cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
593- cli.delete_series('old_series')
594+ with self.assertRaises(Exception):
595+ with _mocked_session('delete', 401):
596+ cli = InfluxDBClient('host', 8086, 'username',
597+ 'password', 'db')
598+ cli.delete_series('old_series')
599
600 def test_get_series_list(self):
601 """Test get list of series for TestInfluxDBClient."""
602@@ -662,29 +668,30 @@ class TestInfluxDBClient(unittest.TestCase):
603 }
604 )
605
606- @raises(NotImplementedError)
607 def test_get_list_database_admins(self):
608 """Test get list of database admins for TestInfluxDBClient."""
609 cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
610- cli.get_list_database_admins()
611+ with self.assertRaises(NotImplementedError):
612+ cli.get_list_database_admins()
613
614- @raises(NotImplementedError)
615 def test_add_database_admin(self):
616 """Test add database admins for TestInfluxDBClient."""
617 cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
618- cli.add_database_admin('admin', 'admin_secret_password')
619+ with self.assertRaises(NotImplementedError):
620+ cli.add_database_admin('admin', 'admin_secret_password')
621
622- @raises(NotImplementedError)
623 def test_update_database_admin_password(self):
624 """Test update database admin pass for TestInfluxDBClient."""
625 cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
626- cli.update_database_admin_password('admin', 'admin_secret_password')
627+ with self.assertRaises(NotImplementedError):
628+ cli.update_database_admin_password('admin',
629+ 'admin_secret_password')
630
631- @raises(NotImplementedError)
632 def test_delete_database_admin(self):
633 """Test delete database admin for TestInfluxDBClient."""
634 cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
635- cli.delete_database_admin('admin')
636+ with self.assertRaises(NotImplementedError):
637+ cli.delete_database_admin('admin')
638
639 def test_get_database_users(self):
640 """Test get database users for TestInfluxDBClient."""
641@@ -842,11 +849,11 @@ class TestInfluxDBClient(unittest.TestCase):
642
643 self.assertIsNone(m.last_request.body)
644
645- @raises(NotImplementedError)
646 def test_update_permission(self):
647 """Test update permission for TestInfluxDBClient."""
648 cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
649- cli.update_permission('admin', [])
650+ with self.assertRaises(NotImplementedError):
651+ cli.update_permission('admin', [])
652
653 @mock.patch('requests.Session.request')
654 def test_request_retry(self, mock_request):
655diff --git a/influxdb/tests/influxdb08/dataframe_client_test.py b/influxdb/tests/influxdb08/dataframe_client_test.py
656index 0a766af..104ae6b 100644
657--- a/influxdb/tests/influxdb08/dataframe_client_test.py
658+++ b/influxdb/tests/influxdb08/dataframe_client_test.py
659@@ -10,8 +10,6 @@ import warnings
660
661 import requests_mock
662
663-from nose.tools import raises
664-
665 from influxdb.tests import skip_if_pypy, using_pypy
666
667 from .client_test import _mocked_session
668@@ -191,33 +189,33 @@ class TestDataFrameClient(unittest.TestCase):
669 cli.write_points({"foo": dataframe}, time_precision='u')
670 self.assertListEqual(json.loads(m.last_request.body), points_us)
671
672- @raises(TypeError)
673 def test_write_points_from_dataframe_fails_without_time_index(self):
674 """Test write points from dataframe that fails without time index."""
675 dataframe = pd.DataFrame(data=[["1", 1, 1.0], ["2", 2, 2.0]],
676 columns=["column_one", "column_two",
677 "column_three"])
678
679- with requests_mock.Mocker() as m:
680- m.register_uri(requests_mock.POST,
681- "http://localhost:8086/db/db/series")
682+ with self.assertRaises(TypeError):
683+ with requests_mock.Mocker() as m:
684+ m.register_uri(requests_mock.POST,
685+ "http://localhost:8086/db/db/series")
686
687- cli = DataFrameClient(database='db')
688- cli.write_points({"foo": dataframe})
689+ cli = DataFrameClient(database='db')
690+ cli.write_points({"foo": dataframe})
691
692- @raises(TypeError)
693 def test_write_points_from_dataframe_fails_with_series(self):
694 """Test failed write points from dataframe with series."""
695 now = pd.Timestamp('1970-01-01 00:00+00:00')
696 dataframe = pd.Series(data=[1.0, 2.0],
697 index=[now, now + timedelta(hours=1)])
698
699- with requests_mock.Mocker() as m:
700- m.register_uri(requests_mock.POST,
701- "http://localhost:8086/db/db/series")
702+ with self.assertRaises(TypeError):
703+ with requests_mock.Mocker() as m:
704+ m.register_uri(requests_mock.POST,
705+ "http://localhost:8086/db/db/series")
706
707- cli = DataFrameClient(database='db')
708- cli.write_points({"foo": dataframe})
709+ cli = DataFrameClient(database='db')
710+ cli.write_points({"foo": dataframe})
711
712 def test_query_into_dataframe(self):
713 """Test query into a dataframe."""