summaryrefslogtreecommitdiff
path: root/tooz/tests
diff options
context:
space:
mode:
authorJulien Danjou <julien@danjou.info>2016-12-02 13:43:33 +0100
committerJulien Danjou <julien@danjou.info>2016-12-07 23:40:35 +0100
commit04866ab9c31f499b612aac17d25584672f832758 (patch)
tree50259f05cdfbf569548955b30eacbc990d99d553 /tooz/tests
parentbb20e9f8a8a7a6e61d923848f1b4773b5ac37ace (diff)
downloadtooz-04866ab9c31f499b612aac17d25584672f832758.tar.gz
Move ToozError to root module
Change-Id: I73b1c5a37b75991f79d8a5fb383c605689503333
Diffstat (limited to 'tooz/tests')
-rw-r--r--tooz/tests/drivers/test_file.py3
-rw-r--r--tooz/tests/test_coordination.py3
-rw-r--r--tooz/tests/test_mysql.py3
-rw-r--r--tooz/tests/test_postgresql.py7
-rw-r--r--tooz/tests/test_utils.py6
5 files changed, 13 insertions, 9 deletions
diff --git a/tooz/tests/drivers/test_file.py b/tooz/tests/drivers/test_file.py
index f392f18..149c371 100644
--- a/tooz/tests/drivers/test_file.py
+++ b/tooz/tests/drivers/test_file.py
@@ -21,6 +21,7 @@ import fixtures
import mock
from testtools import testcase
+import tooz
from tooz import coordination
from tooz import tests
@@ -52,7 +53,7 @@ class TestFileDriver(testcase.TestCase):
pass
os.unlink(os.path.join(file_path, 'groups',
safe_group_id, '.metadata'))
- self.assertRaises(coordination.ToozError,
+ self.assertRaises(tooz.ToozError,
coord.delete_group(b"my_group").get)
@mock.patch('os.path.normpath', lambda x: x.replace('/', '\\'))
diff --git a/tooz/tests/test_coordination.py b/tooz/tests/test_coordination.py
index c073161..6f5979f 100644
--- a/tooz/tests/test_coordination.py
+++ b/tooz/tests/test_coordination.py
@@ -25,6 +25,7 @@ from six.moves.urllib import parse
from testtools import matchers
from testtools import testcase
+import tooz
import tooz.coordination
from tooz import tests
@@ -78,7 +79,7 @@ class TestAPI(tests.TestCaseSkipNotImplemented):
def test_stop_first(self):
c = tooz.coordination.get_coordinator(self.url,
self.member_id)
- self.assertRaises(tooz.coordination.ToozError,
+ self.assertRaises(tooz.ToozError,
c.stop)
def test_create_group(self):
diff --git a/tooz/tests/test_mysql.py b/tooz/tests/test_mysql.py
index 01cc93f..291f44a 100644
--- a/tooz/tests/test_mysql.py
+++ b/tooz/tests/test_mysql.py
@@ -18,6 +18,7 @@
from oslo_utils import encodeutils
from testtools import testcase
+import tooz
from tooz import coordination
from tooz import tests
@@ -29,7 +30,7 @@ class TestMySQLDriver(testcase.TestCase):
def _safe_stop(coord):
try:
coord.stop()
- except coordination.ToozError as e:
+ except tooz.ToozError as e:
message = encodeutils.exception_to_unicode(e)
if (message != 'Can not stop a driver which has not'
' been started'):
diff --git a/tooz/tests/test_postgresql.py b/tooz/tests/test_postgresql.py
index 24d86ea..8556d94 100644
--- a/tooz/tests/test_postgresql.py
+++ b/tooz/tests/test_postgresql.py
@@ -24,6 +24,7 @@ from oslo_utils import encodeutils
import testtools
from testtools import testcase
+import tooz
from tooz import coordination
from tooz import tests
@@ -47,7 +48,7 @@ class TestPostgreSQLFailures(testcase.TestCase):
def _safe_stop(coord):
try:
coord.stop()
- except coordination.ToozError as e:
+ except tooz.ToozError as e:
# TODO(harlowja): make this better, so that we don't have to
# do string checking...
message = encodeutils.exception_to_unicode(e)
@@ -88,7 +89,7 @@ class TestPostgreSQLFailures(testcase.TestCase):
c = self._create_coordinator()
c.start()
test_lock = c.get_lock(b'test-lock')
- self.assertRaises(coordination.ToozError, test_lock.acquire)
+ self.assertRaises(tooz.ToozError, test_lock.acquire)
@mock.patch("tooz.drivers.pgsql.psycopg2.connect")
def test_failure_release_lock(self, psycopg2_connector):
@@ -110,4 +111,4 @@ class TestPostgreSQLFailures(testcase.TestCase):
c.start()
test_lock = c.get_lock(b'test-lock')
self.assertTrue(test_lock.acquire())
- self.assertRaises(coordination.ToozError, test_lock.release)
+ self.assertRaises(tooz.ToozError, test_lock.release)
diff --git a/tooz/tests/test_utils.py b/tooz/tests/test_utils.py
index 6145f4c..39f83fb 100644
--- a/tooz/tests/test_utils.py
+++ b/tooz/tests/test_utils.py
@@ -22,7 +22,7 @@ import futurist
import six
from testtools import testcase
-from tooz import coordination
+import tooz
from tooz import utils
@@ -54,13 +54,13 @@ class TestProxyExecutor(testcase.TestCase):
def test_fetch_unknown_executor(self):
options = {'executor': 'huh'}
- self.assertRaises(coordination.ToozError,
+ self.assertRaises(tooz.ToozError,
utils.ProxyExecutor.build, 'test',
options)
def test_no_submit_stopped(self):
executor = utils.ProxyExecutor.build("test", {})
- self.assertRaises(coordination.ToozError,
+ self.assertRaises(tooz.ToozError,
executor.submit, lambda: None)