From: Zhongyue Luo Date: Fri, 6 Sep 2013 04:01:26 +0000 (+0800) Subject: Utilizes assertIsNotNone X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=c960500ecd25a89a4286034f7d0e71353f85ac1e;p=openstack-build%2Fcinder-build.git Utilizes assertIsNotNone Using assertTrue and the 'is not' operator to test if an element is not None is too python2.4. Our unit testing framework supports assertIsNotNone, included from python 2.7, which was created for these types of tests. Change-Id: I25c3f2b144357a3f86625deb8e324d78c20b9ce4 --- diff --git a/cinder/tests/scheduler/test_filter_scheduler.py b/cinder/tests/scheduler/test_filter_scheduler.py index e9f673ce8..f5a7a4d0e 100644 --- a/cinder/tests/scheduler/test_filter_scheduler.py +++ b/cinder/tests/scheduler/test_filter_scheduler.py @@ -94,7 +94,7 @@ class FilterSchedulerTestCase(test_scheduler.SchedulerTestCase): 'size': 1}} self.mox.ReplayAll() weighed_host = sched._schedule(fake_context, request_spec, {}) - self.assertTrue(weighed_host.obj is not None) + self.assertIsNotNone(weighed_host.obj) def test_max_attempts(self): self.flags(scheduler_max_attempts=4) diff --git a/cinder/tests/test_hp3par.py b/cinder/tests/test_hp3par.py index 011c47172..ed568b2fd 100644 --- a/cinder/tests/test_hp3par.py +++ b/cinder/tests/test_hp3par.py @@ -566,7 +566,7 @@ class HP3PARBaseDriver(): 'source_volid': HP3PARBaseDriver.VOLUME_ID} src_vref = {} model_update = self.driver.create_cloned_volume(volume, src_vref) - self.assertTrue(model_update is not None) + self.assertIsNotNone(model_update) def test_create_snapshot(self): self.flags(lock_path=self.tempdir)