summaryrefslogtreecommitdiff
path: root/oslo_concurrency
diff options
context:
space:
mode:
authorgecong1973 <ge.cong@zte.com.cn>2016-10-08 09:30:32 +0800
committergecong1973 <ge.cong@zte.com.cn>2016-10-08 09:30:32 +0800
commit7a4d633ba6ec37b29eb5adfaaad3f32452318d35 (patch)
treeb09af755e46a118abb19c5d5e29ef7996bc8b1ef /oslo_concurrency
parent14f103960e008a5c4ac6ffe13160ef53774ffff9 (diff)
downloadoslo-concurrency-7a4d633ba6ec37b29eb5adfaaad3f32452318d35.tar.gz
Change assertTrue(isinstance()) by optimal assert
Some of tests use different method of assertTrue(isinstance(A, B)) or assertEqual(type(A), B). The correct way is to use assertIsInstance(A, B) provided by testtools Change-Id: Iad2ee275837c28b40c1062386db5a29969ee98dc
Diffstat (limited to 'oslo_concurrency')
-rw-r--r--oslo_concurrency/tests/unit/test_lockutils.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/oslo_concurrency/tests/unit/test_lockutils.py b/oslo_concurrency/tests/unit/test_lockutils.py
index 667028e..683d89f 100644
--- a/oslo_concurrency/tests/unit/test_lockutils.py
+++ b/oslo_concurrency/tests/unit/test_lockutils.py
@@ -263,9 +263,9 @@ class LockTestCase(test_base.BaseTestCase):
# a semaphore will be yielded
with lockutils.lock("test") as sem:
if six.PY2:
- self.assertTrue(isinstance(sem, threading._Semaphore))
+ self.assertIsInstance(sem, threading._Semaphore)
else:
- self.assertTrue(isinstance(sem, threading.Semaphore))
+ self.assertIsInstance(sem, threading.Semaphore)
# NOTE(flaper87): Lock is external so an InterProcessLock
# will be yielded.
@@ -274,8 +274,8 @@ class LockTestCase(test_base.BaseTestCase):
with lockutils.lock("test1",
external=True) as lock1:
- self.assertTrue(isinstance(lock1,
- lockutils.InterProcessLock))
+ self.assertIsInstance(lock1,
+ lockutils.InterProcessLock)
finally:
if os.path.exists(lock_dir):
shutil.rmtree(lock_dir, ignore_errors=True)
@@ -289,9 +289,9 @@ class LockTestCase(test_base.BaseTestCase):
try:
with lockutils.lock("test") as sem:
if six.PY2:
- self.assertTrue(isinstance(sem, threading._Semaphore))
+ self.assertIsInstance(sem, threading._Semaphore)
else:
- self.assertTrue(isinstance(sem, threading.Semaphore))
+ self.assertIsInstance(sem, threading.Semaphore)
with lockutils.lock("test2", external=True) as lock:
self.assertTrue(lock.exists())