summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDinesh Bhor <dinesh.bhor@nttdata.com>2017-07-04 19:26:12 +0530
committerDinesh Bhor <dinesh.bhor@nttdata.com>2017-07-05 17:37:52 +0530
commitd4f982449ed1a5110896fe92187daeb3ca18161f (patch)
treef91d2e8f0c8e49ce80a85d6443e7f20fa35d6a6e
parent166abca802b6196cbe2042fb527440b9b72e3420 (diff)
Use os-testr instead of testr
Masakari should use ostestr instead of testr. ostestr is more powerful and provide much prettier output than testr. Other projects like cinder, nova, glance, neutron etc already uses the ostestr wrapper. Using ostestr shows each tests execution separately because of which it has shown errors related to "KeyError" in existing test cases. The error looks like below: "Exception in string format operation: KeyError: u'id'" This happens if we don't pass keyword argument like "id" to exception which we expect to be raised from test through side_effect [1]. This doesn't lead to test failure but it appears in test logs. This patch fixes such issues by passing expected keyword arguments to exceptions. [1] https://github.com/openstack/masakari/blob/master/masakari/tests/unit/api/openstack/ha/test_hosts.py#L364 Change-Id: I91603ea3dcf35fd20a00dcf477b93d612edca362
Notes
Notes (review): Code-Review+2: Rikimaru Honjo <honjo.rikimaru@po.ntt-tx.co.jp> Workflow+1: Tushar Patil <tushar.vitthal.patil@gmail.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 10 Jul 2017 06:56:14 +0000 Reviewed-on: https://review.openstack.org/481623 Project: openstack/masakari Branch: refs/heads/master
-rw-r--r--masakari/tests/unit/api/openstack/ha/test_hosts.py19
-rw-r--r--masakari/tests/unit/api/openstack/ha/test_notifications.py14
-rw-r--r--masakari/tests/unit/api/openstack/ha/test_segments.py14
-rw-r--r--masakari/tests/unit/ha/test_api.py21
-rw-r--r--masakari/tests/unit/objects/test_hosts.py2
-rw-r--r--masakari/tests/unit/objects/test_segments.py3
-rw-r--r--test-requirements.txt1
-rw-r--r--tox.ini29
8 files changed, 70 insertions, 33 deletions
diff --git a/masakari/tests/unit/api/openstack/ha/test_hosts.py b/masakari/tests/unit/api/openstack/ha/test_hosts.py
index dde9dcc..bedf48a 100644
--- a/masakari/tests/unit/api/openstack/ha/test_hosts.py
+++ b/masakari/tests/unit/api/openstack/ha/test_hosts.py
@@ -190,7 +190,7 @@ class HostTestCase(test.TestCase):
190 req = fakes.HTTPRequest.blank('/v1/segments/%s/hosts?marker=123456' % ( 190 req = fakes.HTTPRequest.blank('/v1/segments/%s/hosts?marker=123456' % (
191 uuidsentinel.fake_segment1), use_admin_context=True) 191 uuidsentinel.fake_segment1), use_admin_context=True)
192 mock_segment.return_value = mock.Mock() 192 mock_segment.return_value = mock.Mock()
193 mock_get_all.side_effect = exception.MarkerNotFound 193 mock_get_all.side_effect = exception.MarkerNotFound(marker="123456")
194 self.assertRaises(exc.HTTPBadRequest, self.controller.index, 194 self.assertRaises(exc.HTTPBadRequest, self.controller.index,
195 req, uuidsentinel.fake_segment1) 195 req, uuidsentinel.fake_segment1)
196 196
@@ -210,10 +210,11 @@ class HostTestCase(test.TestCase):
210 self.assertRaises(exc.HTTPBadRequest, self.controller.index, req, 210 self.assertRaises(exc.HTTPBadRequest, self.controller.index, req,
211 uuidsentinel.fake_segment1) 211 uuidsentinel.fake_segment1)
212 212
213 @ddt.data([exception.MarkerNotFound, "/v1/segments/%s/hosts?marker=123456", 213 @ddt.data([exception.MarkerNotFound(marker="123456"),
214 exc.HTTPBadRequest], 214 "/v1/segments/%s/hosts?marker=123456", exc.HTTPBadRequest],
215 [exception.FailoverSegmentNotFound, "/v1/segments/%s/hosts", 215 [exception.FailoverSegmentNotFound(
216 exc.HTTPNotFound]) 216 id=uuidsentinel.fake_segment1), "/v1/segments/%s/hosts",
217 exc.HTTPNotFound])
217 @ddt.unpack 218 @ddt.unpack
218 @mock.patch.object(segment_obj.FailoverSegment, 'get_by_uuid') 219 @mock.patch.object(segment_obj.FailoverSegment, 'get_by_uuid')
219 @mock.patch.object(ha_api.HostAPI, 'get_all') 220 @mock.patch.object(ha_api.HostAPI, 'get_all')
@@ -361,7 +362,7 @@ class HostTestCase(test.TestCase):
361 @mock.patch.object(ha_api.HostAPI, 'get_host') 362 @mock.patch.object(ha_api.HostAPI, 'get_host')
362 def test_show_with_non_existing_id(self, mock_get_host): 363 def test_show_with_non_existing_id(self, mock_get_host):
363 364
364 mock_get_host.side_effect = exception.HostNotFound 365 mock_get_host.side_effect = exception.HostNotFound(id="2")
365 self.assertRaises(exc.HTTPNotFound, 366 self.assertRaises(exc.HTTPNotFound,
366 self.controller.show, self.req, 367 self.controller.show, self.req,
367 uuidsentinel.fake_segment1, "2") 368 uuidsentinel.fake_segment1, "2")
@@ -420,14 +421,14 @@ class HostTestCase(test.TestCase):
420 def test_update_with_non_exising_host(self, mock_update_host): 421 def test_update_with_non_exising_host(self, mock_update_host):
421 422
422 test_data = {"host": {"name": "host11"}} 423 test_data = {"host": {"name": "host11"}}
423 mock_update_host.side_effect = exception.HostNotFound 424 mock_update_host.side_effect = exception.HostNotFound(id="2")
424 self.assertRaises(exc.HTTPNotFound, self.controller.update, 425 self.assertRaises(exc.HTTPNotFound, self.controller.update,
425 self.req, uuidsentinel.fake_segment1, "2", body=test_data) 426 self.req, uuidsentinel.fake_segment1, "2", body=test_data)
426 427
427 @mock.patch.object(ha_api.HostAPI, 'update_host') 428 @mock.patch.object(ha_api.HostAPI, 'update_host')
428 def test_update_with_duplicated_name(self, mock_update_host): 429 def test_update_with_duplicated_name(self, mock_update_host):
429 test_data = {"host": {"name": "host-1"}} 430 test_data = {"host": {"name": "host-1"}}
430 mock_update_host.side_effect = exception.HostExists 431 mock_update_host.side_effect = exception.HostExists(name="host-1")
431 self.assertRaises(exc.HTTPConflict, self.controller.update, 432 self.assertRaises(exc.HTTPConflict, self.controller.update,
432 self.req, uuidsentinel.fake_segment1, 433 self.req, uuidsentinel.fake_segment1,
433 uuidsentinel.fake_host_1, body=test_data) 434 uuidsentinel.fake_host_1, body=test_data)
@@ -455,7 +456,7 @@ class HostTestCase(test.TestCase):
455 @mock.patch.object(ha_api.HostAPI, 'delete_host') 456 @mock.patch.object(ha_api.HostAPI, 'delete_host')
456 def test_delete_host_not_found(self, mock_delete): 457 def test_delete_host_not_found(self, mock_delete):
457 458
458 mock_delete.side_effect = exception.HostNotFound 459 mock_delete.side_effect = exception.HostNotFound(id="2")
459 self.assertRaises(exc.HTTPNotFound, self.controller.delete, 460 self.assertRaises(exc.HTTPNotFound, self.controller.delete,
460 self.req, uuidsentinel.fake_segment1, 461 self.req, uuidsentinel.fake_segment1,
461 uuidsentinel.fake_host_3) 462 uuidsentinel.fake_host_3)
diff --git a/masakari/tests/unit/api/openstack/ha/test_notifications.py b/masakari/tests/unit/api/openstack/ha/test_notifications.py
index 4b21460..263b480 100644
--- a/masakari/tests/unit/api/openstack/ha/test_notifications.py
+++ b/masakari/tests/unit/api/openstack/ha/test_notifications.py
@@ -129,7 +129,7 @@ class NotificationTestCase(test.TestCase):
129 def test_index_marker_not_found(self, mock_get_all): 129 def test_index_marker_not_found(self, mock_get_all):
130 fake_request = fakes.HTTPRequest.blank('/v1/notifications?marker=1234', 130 fake_request = fakes.HTTPRequest.blank('/v1/notifications?marker=1234',
131 use_admin_context=True) 131 use_admin_context=True)
132 mock_get_all.side_effect = exception.MarkerNotFound 132 mock_get_all.side_effect = exception.MarkerNotFound(marker="1234")
133 self.assertRaises(exc.HTTPBadRequest, self.controller.index, 133 self.assertRaises(exc.HTTPBadRequest, self.controller.index,
134 fake_request) 134 fake_request)
135 135
@@ -195,7 +195,8 @@ class NotificationTestCase(test.TestCase):
195 "cluster_status": "ONLINE"}, 195 "cluster_status": "ONLINE"},
196 "type": "VM", 196 "type": "VM",
197 "generated_time": "2016-09-13T09:11:21.656788"}} 197 "generated_time": "2016-09-13T09:11:21.656788"}}
198 mock_create.side_effect = exception.HostNotFoundByName 198 mock_create.side_effect = exception.HostNotFoundByName(
199 host_name="fake_host")
199 self.assertRaises(exc.HTTPBadRequest, self.controller.create, 200 self.assertRaises(exc.HTTPBadRequest, self.controller.create,
200 self.req, body=body) 201 self.req, body=body)
201 202
@@ -273,7 +274,8 @@ class NotificationTestCase(test.TestCase):
273 274
274 @mock.patch.object(ha_api.NotificationAPI, 'create_notification') 275 @mock.patch.object(ha_api.NotificationAPI, 'create_notification')
275 def test_create_duplicate_notification(self, mock_create_notification): 276 def test_create_duplicate_notification(self, mock_create_notification):
276 mock_create_notification.side_effect = exception.DuplicateNotification 277 mock_create_notification.side_effect = exception.DuplicateNotification(
278 type="COMPUTE_HOST")
277 body = { 279 body = {
278 "notification": {"hostname": "fake_host", 280 "notification": {"hostname": "fake_host",
279 "payload": {"event": "STOPPED", 281 "payload": {"event": "STOPPED",
@@ -286,7 +288,8 @@ class NotificationTestCase(test.TestCase):
286 288
287 @mock.patch.object(ha_api.NotificationAPI, 'create_notification') 289 @mock.patch.object(ha_api.NotificationAPI, 'create_notification')
288 def test_create_host_on_maintenance(self, mock_create_notification): 290 def test_create_host_on_maintenance(self, mock_create_notification):
289 mock_create_notification.side_effect = exception.HostOnMaintenanceError 291 mock_create_notification.side_effect = (
292 exception.HostOnMaintenanceError(host_name="fake_host"))
290 body = { 293 body = {
291 "notification": {"hostname": "fake_host", 294 "notification": {"hostname": "fake_host",
292 "payload": {"event": "STOPPED", 295 "payload": {"event": "STOPPED",
@@ -310,7 +313,8 @@ class NotificationTestCase(test.TestCase):
310 @mock.patch.object(ha_api.NotificationAPI, 'get_notification') 313 @mock.patch.object(ha_api.NotificationAPI, 'get_notification')
311 def test_show_with_non_existing_uuid(self, mock_get_notification): 314 def test_show_with_non_existing_uuid(self, mock_get_notification):
312 315
313 mock_get_notification.side_effect = exception.NotificationNotFound 316 mock_get_notification.side_effect = exception.NotificationNotFound(
317 id="2")
314 self.assertRaises(exc.HTTPNotFound, 318 self.assertRaises(exc.HTTPNotFound,
315 self.controller.show, self.req, "2") 319 self.controller.show, self.req, "2")
316 320
diff --git a/masakari/tests/unit/api/openstack/ha/test_segments.py b/masakari/tests/unit/api/openstack/ha/test_segments.py
index 55f5d0c..76fad9f 100644
--- a/masakari/tests/unit/api/openstack/ha/test_segments.py
+++ b/masakari/tests/unit/api/openstack/ha/test_segments.py
@@ -94,7 +94,7 @@ class FailoverSegmentTestCase(test.TestCase):
94 def test_index_marker_not_found(self, mock_get_all): 94 def test_index_marker_not_found(self, mock_get_all):
95 fake_request = fakes.HTTPRequest.blank('/v1/segments?marker=12345', 95 fake_request = fakes.HTTPRequest.blank('/v1/segments?marker=12345',
96 use_admin_context=True) 96 use_admin_context=True)
97 mock_get_all.side_effect = exception.MarkerNotFound 97 mock_get_all.side_effect = exception.MarkerNotFound(marker="12345")
98 self.assertRaises(exc.HTTPBadRequest, self.controller.index, 98 self.assertRaises(exc.HTTPBadRequest, self.controller.index,
99 fake_request) 99 fake_request)
100 100
@@ -227,7 +227,8 @@ class FailoverSegmentTestCase(test.TestCase):
227 @mock.patch.object(ha_api.FailoverSegmentAPI, 'get_segment') 227 @mock.patch.object(ha_api.FailoverSegmentAPI, 'get_segment')
228 def test_show_with_non_existing_id(self, mock_get_segment): 228 def test_show_with_non_existing_id(self, mock_get_segment):
229 229
230 mock_get_segment.side_effect = exception.FailoverSegmentNotFound 230 mock_get_segment.side_effect = exception.FailoverSegmentNotFound(
231 id="2")
231 self.assertRaises(exc.HTTPNotFound, 232 self.assertRaises(exc.HTTPNotFound,
232 self.controller.show, self.req, "2") 233 self.controller.show, self.req, "2")
233 234
@@ -275,14 +276,16 @@ class FailoverSegmentTestCase(test.TestCase):
275 def test_update_with_non_exising_segment(self, mock_update_segment): 276 def test_update_with_non_exising_segment(self, mock_update_segment):
276 277
277 test_data = {"segment": {"name": "segment11"}} 278 test_data = {"segment": {"name": "segment11"}}
278 mock_update_segment.side_effect = exception.FailoverSegmentNotFound 279 mock_update_segment.side_effect = exception.FailoverSegmentNotFound(
280 id="2")
279 self.assertRaises(exc.HTTPNotFound, self.controller.update, 281 self.assertRaises(exc.HTTPNotFound, self.controller.update,
280 self.req, "2", body=test_data) 282 self.req, "2", body=test_data)
281 283
282 @mock.patch.object(ha_api.FailoverSegmentAPI, 'update_segment') 284 @mock.patch.object(ha_api.FailoverSegmentAPI, 'update_segment')
283 def test_update_with_duplicated_name(self, mock_update_segment): 285 def test_update_with_duplicated_name(self, mock_update_segment):
284 test_data = {"segment": {"name": "segment1"}} 286 test_data = {"segment": {"name": "segment1"}}
285 mock_update_segment.side_effect = exception.FailoverSegmentExists 287 mock_update_segment.side_effect = exception.FailoverSegmentExists(
288 name="segment1")
286 self.assertRaises(exc.HTTPConflict, self.controller.update, 289 self.assertRaises(exc.HTTPConflict, self.controller.update,
287 self.req, uuidsentinel.fake_segment, body=test_data) 290 self.req, uuidsentinel.fake_segment, body=test_data)
288 291
@@ -295,7 +298,8 @@ class FailoverSegmentTestCase(test.TestCase):
295 @mock.patch.object(ha_api.FailoverSegmentAPI, 'delete_segment') 298 @mock.patch.object(ha_api.FailoverSegmentAPI, 'delete_segment')
296 def test_delete_segment_not_found(self, mock_delete): 299 def test_delete_segment_not_found(self, mock_delete):
297 300
298 mock_delete.side_effect = exception.FailoverSegmentNotFound 301 mock_delete.side_effect = exception.FailoverSegmentNotFound(
302 id=uuidsentinel.fake_segment)
299 self.assertRaises(exc.HTTPNotFound, self.controller.delete, 303 self.assertRaises(exc.HTTPNotFound, self.controller.delete,
300 self.req, uuidsentinel.fake_segment) 304 self.req, uuidsentinel.fake_segment)
301 305
diff --git a/masakari/tests/unit/ha/test_api.py b/masakari/tests/unit/ha/test_api.py
index bed538f..36629ea 100644
--- a/masakari/tests/unit/ha/test_api.py
+++ b/masakari/tests/unit/ha/test_api.py
@@ -86,11 +86,11 @@ class FailoverSegmentAPITestCase(test.NoDBTestCase):
86 @mock.patch.object(segment_obj.FailoverSegmentList, 'get_all') 86 @mock.patch.object(segment_obj.FailoverSegmentList, 'get_all')
87 def test_get_all_marker_not_found(self, mock_get_all): 87 def test_get_all_marker_not_found(self, mock_get_all):
88 88
89 mock_get_all.side_effect = exception.MarkerNotFound 89 mock_get_all.side_effect = exception.MarkerNotFound(marker='123')
90 90
91 self.assertRaises(exception.MarkerNotFound, self.segment_api.get_all, 91 self.assertRaises(exception.MarkerNotFound, self.segment_api.get_all,
92 self.context, filters=None, sort_keys=None, 92 self.context, filters=None, sort_keys=None,
93 sort_dirs=None, limit=None, marker=None) 93 sort_dirs=None, limit=None, marker='123')
94 94
95 @mock.patch.object(segment_obj.FailoverSegmentList, 'get_all') 95 @mock.patch.object(segment_obj.FailoverSegmentList, 'get_all')
96 def test_get_all_by_recovery_method(self, mock_get_all): 96 def test_get_all_by_recovery_method(self, mock_get_all):
@@ -105,7 +105,8 @@ class FailoverSegmentAPITestCase(test.NoDBTestCase):
105 @mock.patch.object(segment_obj.FailoverSegmentList, 'get_all') 105 @mock.patch.object(segment_obj.FailoverSegmentList, 'get_all')
106 def test_get_all_invalid_sort_dir(self, mock_get_all): 106 def test_get_all_invalid_sort_dir(self, mock_get_all):
107 107
108 mock_get_all.side_effect = exception.InvalidInput 108 mock_get_all.side_effect = exception.InvalidInput(
109 reason="Unknown sort direction, must be 'asc' or 'desc'")
109 self.assertRaises(exception.InvalidInput, self.segment_api.get_all, 110 self.assertRaises(exception.InvalidInput, self.segment_api.get_all,
110 self.context, filters=None, sort_keys=None, 111 self.context, filters=None, sort_keys=None,
111 sort_dirs=['abcd'], limit=None, marker=None) 112 sort_dirs=['abcd'], limit=None, marker=None)
@@ -222,12 +223,12 @@ class HostAPITestCase(test.NoDBTestCase):
222 @mock.patch.object(segment_obj.FailoverSegment, 'get_by_uuid') 223 @mock.patch.object(segment_obj.FailoverSegment, 'get_by_uuid')
223 def test_get_all_marker_not_found(self, mock_get, mock_get_all): 224 def test_get_all_marker_not_found(self, mock_get, mock_get_all):
224 mock_get.return_value = self.failover_segment 225 mock_get.return_value = self.failover_segment
225 mock_get_all.side_effect = exception.MarkerNotFound 226 mock_get_all.side_effect = exception.MarkerNotFound(marker="1234")
226 227
227 self.assertRaises(exception.MarkerNotFound, self.host_api.get_all, 228 self.assertRaises(exception.MarkerNotFound, self.host_api.get_all,
228 self.context, filters=None, sort_keys=['created_at'], 229 self.context, filters=None, sort_keys=['created_at'],
229 sort_dirs=['desc'], limit=None, 230 sort_dirs=['desc'], limit=None,
230 marker=None) 231 marker="1234")
231 232
232 @mock.patch.object(host_obj.HostList, 'get_all') 233 @mock.patch.object(host_obj.HostList, 'get_all')
233 def test_get_all_by_type(self, mock_get): 234 def test_get_all_by_type(self, mock_get):
@@ -243,7 +244,8 @@ class HostAPITestCase(test.NoDBTestCase):
243 @mock.patch.object(host_obj.HostList, 'get_all') 244 @mock.patch.object(host_obj.HostList, 'get_all')
244 def test_get_all_invalid_sort_dir(self, mock_get): 245 def test_get_all_invalid_sort_dir(self, mock_get):
245 246
246 mock_get.side_effect = exception.InvalidInput 247 mock_get.side_effect = exception.InvalidInput(
248 reason="Unknown sort direction, must be 'asc' or 'desc'")
247 249
248 self.assertRaises(exception.InvalidInput, self.host_api.get_all, 250 self.assertRaises(exception.InvalidInput, self.host_api.get_all,
249 self.context, filters=None, sort_keys=None, 251 self.context, filters=None, sort_keys=None,
@@ -554,8 +556,8 @@ class NotificationAPITestCase(test.NoDBTestCase):
554 @mock.patch.object(notification_obj.NotificationList, 'get_all') 556 @mock.patch.object(notification_obj.NotificationList, 'get_all')
555 def test_get_all_marker_not_found(self, mock_get_all): 557 def test_get_all_marker_not_found(self, mock_get_all):
556 558
557 mock_get_all.side_effect = exception.MarkerNotFound 559 mock_get_all.side_effect = exception.MarkerNotFound(marker="100")
558 self.req = fakes.HTTPRequest.blank('/v1/notifications?limit=100', 560 self.req = fakes.HTTPRequest.blank('/v1/notifications?marker=100',
559 use_admin_context=True) 561 use_admin_context=True)
560 self.assertRaises(exception.MarkerNotFound, 562 self.assertRaises(exception.MarkerNotFound,
561 self.notification_api.get_all, 563 self.notification_api.get_all,
@@ -575,7 +577,8 @@ class NotificationAPITestCase(test.NoDBTestCase):
575 @mock.patch.object(notification_obj.NotificationList, 'get_all') 577 @mock.patch.object(notification_obj.NotificationList, 'get_all')
576 def test_get_all_invalid_sort_dir(self, mock_get_all): 578 def test_get_all_invalid_sort_dir(self, mock_get_all):
577 579
578 mock_get_all.side_effect = exception.InvalidInput 580 mock_get_all.side_effect = exception.InvalidInput(
581 reason="Unknown sort direction, must be 'asc' or 'desc'")
579 self.req = fakes.HTTPRequest.blank('/v1/notifications?sort_dir=abcd', 582 self.req = fakes.HTTPRequest.blank('/v1/notifications?sort_dir=abcd',
580 use_admin_context=True) 583 use_admin_context=True)
581 self.assertRaises(exception.InvalidInput, 584 self.assertRaises(exception.InvalidInput,
diff --git a/masakari/tests/unit/objects/test_hosts.py b/masakari/tests/unit/objects/test_hosts.py
index 48472e2..9f146aa 100644
--- a/masakari/tests/unit/objects/test_hosts.py
+++ b/masakari/tests/unit/objects/test_hosts.py
@@ -154,7 +154,7 @@ class TestHostObject(test_objects._LocalTest):
154 154
155 @mock.patch.object(db, 'host_delete') 155 @mock.patch.object(db, 'host_delete')
156 def test_destroy_host_not_found(self, mock_host_destroy): 156 def test_destroy_host_not_found(self, mock_host_destroy):
157 mock_host_destroy.side_effect = exception.HostNotFound 157 mock_host_destroy.side_effect = exception.HostNotFound(id=123)
158 host_obj = self._host_create_attributes() 158 host_obj = self._host_create_attributes()
159 host_obj.id = 123 159 host_obj.id = 123
160 self.assertRaises(exception.HostNotFound, host_obj.destroy) 160 self.assertRaises(exception.HostNotFound, host_obj.destroy)
diff --git a/masakari/tests/unit/objects/test_segments.py b/masakari/tests/unit/objects/test_segments.py
index 3e91426..64a2b83 100644
--- a/masakari/tests/unit/objects/test_segments.py
+++ b/masakari/tests/unit/objects/test_segments.py
@@ -124,7 +124,8 @@ class TestFailoverSegmentObject(test_objects._LocalTest):
124 124
125 @mock.patch('masakari.db.failover_segment_delete') 125 @mock.patch('masakari.db.failover_segment_delete')
126 def test_destroy_failover_segment_found(self, mock_segment_destroy): 126 def test_destroy_failover_segment_found(self, mock_segment_destroy):
127 mock_segment_destroy.side_effect = exception.FailoverSegmentNotFound 127 mock_segment_destroy.side_effect = exception.FailoverSegmentNotFound(
128 id=123)
128 segment_obj = self._segment_create_attribute() 129 segment_obj = self._segment_create_attribute()
129 segment_obj.id = 123 130 segment_obj.id = 123
130 self.assertRaises(exception.FailoverSegmentNotFound, 131 self.assertRaises(exception.FailoverSegmentNotFound,
diff --git a/test-requirements.txt b/test-requirements.txt
index 4c607ca..fc53fa3 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -12,6 +12,7 @@ python-subunit>=0.0.18 # Apache-2.0/BSD
12sphinx!=1.6.1,>=1.5.1 # BSD 12sphinx!=1.6.1,>=1.5.1 # BSD
13oslosphinx>=4.7.0 # Apache-2.0 13oslosphinx>=4.7.0 # Apache-2.0
14oslotest>=1.10.0 # Apache-2.0 14oslotest>=1.10.0 # Apache-2.0
15os-testr>=0.8.0 # Apache-2.0
15requests-mock>=1.1 # Apache-2.0 16requests-mock>=1.1 # Apache-2.0
16testrepository>=0.0.18 # Apache-2.0/BSD 17testrepository>=0.0.18 # Apache-2.0/BSD
17testresources>=0.2.4 # Apache-2.0/BSD 18testresources>=0.2.4 # Apache-2.0/BSD
diff --git a/tox.ini b/tox.ini
index 6199812..a5725a9 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,10 +6,33 @@ skipsdist = True
6[testenv] 6[testenv]
7usedevelop = True 7usedevelop = True
8install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages} 8install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt} {opts} {packages}
9setenv = 9setenv = VIRTUAL_ENV={envdir}
10 VIRTUAL_ENV={envdir} 10 OS_TEST_PATH=./masakari/tests/unit
11 LANGUAGE=en_US
12 LC_ALL=en_US.utf-8
11deps = -r{toxinidir}/test-requirements.txt 13deps = -r{toxinidir}/test-requirements.txt
12commands = python setup.py test --slowest --testr-args='{posargs}' 14whitelist_externals = bash
15 find
16 rm
17 env
18# By default ostestr will set concurrency
19# to ncpu, to specify something else use
20# the concurrency=<n> option.
21# call ie: 'tox -epy27 -- --concurrency=4'
22commands =
23 find . -type f -name "*.pyc" -delete
24 rm -Rf .testrepository/times.dbm
25passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY OS_DEBUG GENERATE_HASHES
26
27[testenv:py27]
28commands =
29 {[testenv]commands}
30 ostestr '{posargs}'
31
32[testenv:py34]
33commands =
34 {[testenv]commands}
35 ostestr '{posargs}'
13 36
14[testenv:genconfig] 37[testenv:genconfig]
15commands = oslo-config-generator --config-file=etc/masakari/masakari-config-generator.conf 38commands = oslo-config-generator --config-file=etc/masakari/masakari-config-generator.conf