diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2013-10-28 18:28:05 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2014-02-24 10:26:29 -0800 |
commit | a134930dd5e7404a5316a8ac325b64506a366b81 (patch) | |
tree | e799f537f92096e1abef22eab8dc1f55582a776c /taskflow/test.py | |
parent | ddbdb8f3ddf5ed71b8410025870212de2d5bf43c (diff) | |
download | taskflow-a134930dd5e7404a5316a8ac325b64506a366b81.tar.gz |
Add zookeeper job/jobboard impl
Create a base implementation of a
jobboard which serves as a place to post
work to be done, a place to get notified of
new work, and a place which can be used to
atomically acquire that work (so that it
can be worked on) as well as transfer that
work from one entity (say when that entity
fails) to another entity (for further
resumption or other policy/code driven
recovery processes).
Implements: blueprint job-reference-impl
Change-Id: I1de1525df0deee612fb14ca36f0415ea7d2f707c
Diffstat (limited to 'taskflow/test.py')
-rw-r--r-- | taskflow/test.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/taskflow/test.py b/taskflow/test.py index fe69ffc..6699a35 100644 --- a/taskflow/test.py +++ b/taskflow/test.py @@ -20,6 +20,9 @@ from testtools import compat from testtools import matchers from testtools import testcase +import fixtures +import six + from taskflow import exceptions from taskflow.tests import utils @@ -57,6 +60,33 @@ class FailureRegexpMatcher(object): class TestCase(testcase.TestCase): """Test case base class for all taskflow unit tests.""" + def makeTmpDir(self): + t_dir = self.useFixture(fixtures.TempDir()) + return t_dir.path + + def assertDictEqual(self, expected, check): + self.assertIsInstance(expected, dict, + 'First argument is not a dictionary') + self.assertIsInstance(check, dict, + 'Second argument is not a dictionary') + + # Testtools seems to want equals objects instead of just keys? + compare_dict = {} + for k in list(six.iterkeys(expected)): + if not isinstance(expected[k], matchers.Equals): + compare_dict[k] = matchers.Equals(expected[k]) + else: + compare_dict[k] = expected[k] + self.assertThat(matchee=check, + matcher=matchers.MatchesDict(compare_dict)) + + def assertRaisesAttrAccess(self, exc_class, obj, attr_name): + + def access_func(): + getattr(obj, attr_name) + + self.assertRaises(exc_class, access_func) + def assertRaisesRegexp(self, exc_class, pattern, callable_obj, *args, **kwargs): # TODO(harlowja): submit a pull/review request to testtools to add |