Merge "Remove failure version number"
This commit is contained in:
@@ -152,14 +152,6 @@ class FailureObjectTestCase(test.TestCase):
|
|||||||
}
|
}
|
||||||
self.assertRaises(exceptions.InvalidFormat,
|
self.assertRaises(exceptions.InvalidFormat,
|
||||||
failure.Failure.validate, f)
|
failure.Failure.validate, f)
|
||||||
f = {
|
|
||||||
'exception_str': 'blah',
|
|
||||||
'traceback_str': 'blah',
|
|
||||||
'exc_type_names': ['Exception'],
|
|
||||||
'version': -1,
|
|
||||||
}
|
|
||||||
self.assertRaises(exceptions.InvalidFormat,
|
|
||||||
failure.Failure.validate, f)
|
|
||||||
|
|
||||||
def test_valid_from_dict_to_dict(self):
|
def test_valid_from_dict_to_dict(self):
|
||||||
f = _captured_failure('Woot!')
|
f = _captured_failure('Woot!')
|
||||||
|
|||||||
@@ -121,7 +121,6 @@ class Failure(mixins.StrMixin):
|
|||||||
backport at https://pypi.python.org/pypi/traceback2/ to (hopefully)
|
backport at https://pypi.python.org/pypi/traceback2/ to (hopefully)
|
||||||
simplify the methods and contents of this object...
|
simplify the methods and contents of this object...
|
||||||
"""
|
"""
|
||||||
DICT_VERSION = 1
|
|
||||||
|
|
||||||
BASE_EXCEPTIONS = ('BaseException', 'Exception')
|
BASE_EXCEPTIONS = ('BaseException', 'Exception')
|
||||||
"""
|
"""
|
||||||
@@ -137,10 +136,6 @@ class Failure(mixins.StrMixin):
|
|||||||
"cause": {
|
"cause": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
'properties': {
|
'properties': {
|
||||||
'version': {
|
|
||||||
"type": "integer",
|
|
||||||
"minimum": 0,
|
|
||||||
},
|
|
||||||
'exception_str': {
|
'exception_str': {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
},
|
},
|
||||||
@@ -467,10 +462,6 @@ class Failure(mixins.StrMixin):
|
|||||||
def from_dict(cls, data):
|
def from_dict(cls, data):
|
||||||
"""Converts this from a dictionary to a object."""
|
"""Converts this from a dictionary to a object."""
|
||||||
data = dict(data)
|
data = dict(data)
|
||||||
version = data.pop('version', None)
|
|
||||||
if version != cls.DICT_VERSION:
|
|
||||||
raise ValueError('Invalid dict version of failure object: %r'
|
|
||||||
% version)
|
|
||||||
causes = data.get('causes')
|
causes = data.get('causes')
|
||||||
if causes is not None:
|
if causes is not None:
|
||||||
data['causes'] = tuple(cls.from_dict(d) for d in causes)
|
data['causes'] = tuple(cls.from_dict(d) for d in causes)
|
||||||
@@ -482,7 +473,6 @@ class Failure(mixins.StrMixin):
|
|||||||
'exception_str': self.exception_str,
|
'exception_str': self.exception_str,
|
||||||
'traceback_str': self.traceback_str,
|
'traceback_str': self.traceback_str,
|
||||||
'exc_type_names': list(self),
|
'exc_type_names': list(self),
|
||||||
'version': self.DICT_VERSION,
|
|
||||||
'causes': [f.to_dict() for f in self.causes],
|
'causes': [f.to_dict() for f in self.causes],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user