Created
July 1, 2018 18:41
-
-
Save floli/66c363d84517fa1fcfccf273e0b5e15b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
florian@horus ~/software/borgmatic (git)-[master] % pytest -k "test_check_archives_calls_borg_with_parameters" | |
============================================================================================================================ test session starts ============================================================================================================================= | |
platform linux -- Python 3.6.5, pytest-3.6.2, py-1.5.4, pluggy-0.6.0 | |
rootdir: /home/florian/software/borgmatic, inifile: | |
plugins: cov-2.5.1 | |
collected 170 items / 166 deselected | |
borgmatic/tests/unit/borg/test_check.py FFFF [100%] | |
================================================================================================================================== FAILURES ================================================================================================================================== | |
__________________________________________________________________________________________________________ test_check_archives_calls_borg_with_parameters[checks0] ___________________________________________________________________________________________________________ | |
def flexmock_teardown(): | |
"""Performs lexmock-specific teardown tasks.""" | |
saved = {} | |
instances = [] | |
classes = [] | |
for mock_object, expectations in FlexmockContainer.flexmock_objects.items(): | |
saved[mock_object] = expectations[:] | |
for expectation in expectations: | |
_getattr(expectation, 'reset')() | |
for mock in saved.keys(): | |
obj = mock._object | |
if not isinstance(obj, Mock) and not _isclass(obj): | |
instances.append(obj) | |
if _isclass(obj): | |
classes.append(obj) | |
for obj in instances + classes: | |
for attr in UPDATED_ATTRS: | |
try: | |
obj_dict = obj.__dict__ | |
if _get_code(obj_dict[attr]) is _get_code(Mock.__dict__[attr]): | |
del obj_dict[attr] | |
except: | |
try: | |
if _get_code(getattr(obj, attr)) is _get_code(Mock.__dict__[attr]): | |
delattr(obj, attr) | |
except AttributeError: | |
pass | |
FlexmockContainer.teardown_properties() | |
FlexmockContainer.reset() | |
# make sure this is done last to keep exceptions here from breaking | |
# any of the previous steps that cleanup all the changes | |
for mock_object, expectations in saved.items(): | |
for expectation in expectations: | |
> _getattr(expectation, 'verify')() | |
/usr/lib/python3.6/site-packages/flexmock.py:1180: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
/usr/lib/python3.6/site-packages/flexmock.py:620: in verify | |
(_format_args(self.name, self.args), message, self.times_called)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <flexmock.Expectation object at 0x7fbccb51a550>, exception = <class 'flexmock.MethodCallError'> | |
message = "check_call(('borg', 'check', 'repo'), stdout=<flexmock.MockClass object at 0x7fbccb51a470>, stderr=-2) expected to be called exactly 1 times, called 0 times" | |
def __raise(self, exception, message): | |
"""Safe internal raise implementation. | |
In case we're patching builtins, it's important to reset the | |
expectation before raising any exceptions or else things like | |
open() might be stubbed out and the resulting runner errors are very | |
difficult to diagnose. | |
""" | |
self.reset() | |
> raise exception(message) | |
E flexmock.MethodCallError: check_call(('borg', 'check', 'repo'), stdout=<flexmock.MockClass object at 0x7fbccb51a470>, stderr=-2) expected to be called exactly 1 times, called 0 times | |
/usr/lib/python3.6/site-packages/flexmock.py:349: MethodCallError | |
__________________________________________________________________________________________________________ test_check_archives_calls_borg_with_parameters[checks1] ___________________________________________________________________________________________________________ | |
def flexmock_teardown(): | |
"""Performs lexmock-specific teardown tasks.""" | |
saved = {} | |
instances = [] | |
classes = [] | |
for mock_object, expectations in FlexmockContainer.flexmock_objects.items(): | |
saved[mock_object] = expectations[:] | |
for expectation in expectations: | |
_getattr(expectation, 'reset')() | |
for mock in saved.keys(): | |
obj = mock._object | |
if not isinstance(obj, Mock) and not _isclass(obj): | |
instances.append(obj) | |
if _isclass(obj): | |
classes.append(obj) | |
for obj in instances + classes: | |
for attr in UPDATED_ATTRS: | |
try: | |
obj_dict = obj.__dict__ | |
if _get_code(obj_dict[attr]) is _get_code(Mock.__dict__[attr]): | |
del obj_dict[attr] | |
except: | |
try: | |
if _get_code(getattr(obj, attr)) is _get_code(Mock.__dict__[attr]): | |
delattr(obj, attr) | |
except AttributeError: | |
pass | |
FlexmockContainer.teardown_properties() | |
FlexmockContainer.reset() | |
# make sure this is done last to keep exceptions here from breaking | |
# any of the previous steps that cleanup all the changes | |
for mock_object, expectations in saved.items(): | |
for expectation in expectations: | |
> _getattr(expectation, 'verify')() | |
/usr/lib/python3.6/site-packages/flexmock.py:1180: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
/usr/lib/python3.6/site-packages/flexmock.py:620: in verify | |
(_format_args(self.name, self.args), message, self.times_called)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <flexmock.Expectation object at 0x7fbccb5935f8>, exception = <class 'flexmock.MethodCallError'> | |
message = "check_call(('borg', 'check', 'repo'), stdout=<flexmock.MockClass object at 0x7fbccbc0ea90>, stderr=-2) expected to be called exactly 1 times, called 0 times" | |
def __raise(self, exception, message): | |
"""Safe internal raise implementation. | |
In case we're patching builtins, it's important to reset the | |
expectation before raising any exceptions or else things like | |
open() might be stubbed out and the resulting runner errors are very | |
difficult to diagnose. | |
""" | |
self.reset() | |
> raise exception(message) | |
E flexmock.MethodCallError: check_call(('borg', 'check', 'repo'), stdout=<flexmock.MockClass object at 0x7fbccbc0ea90>, stderr=-2) expected to be called exactly 1 times, called 0 times | |
/usr/lib/python3.6/site-packages/flexmock.py:349: MethodCallError | |
__________________________________________________________________________________________________________ test_check_archives_calls_borg_with_parameters[checks2] ___________________________________________________________________________________________________________ | |
def flexmock_teardown(): | |
"""Performs lexmock-specific teardown tasks.""" | |
saved = {} | |
instances = [] | |
classes = [] | |
for mock_object, expectations in FlexmockContainer.flexmock_objects.items(): | |
saved[mock_object] = expectations[:] | |
for expectation in expectations: | |
_getattr(expectation, 'reset')() | |
for mock in saved.keys(): | |
obj = mock._object | |
if not isinstance(obj, Mock) and not _isclass(obj): | |
instances.append(obj) | |
if _isclass(obj): | |
classes.append(obj) | |
for obj in instances + classes: | |
for attr in UPDATED_ATTRS: | |
try: | |
obj_dict = obj.__dict__ | |
if _get_code(obj_dict[attr]) is _get_code(Mock.__dict__[attr]): | |
del obj_dict[attr] | |
except: | |
try: | |
if _get_code(getattr(obj, attr)) is _get_code(Mock.__dict__[attr]): | |
delattr(obj, attr) | |
except AttributeError: | |
pass | |
FlexmockContainer.teardown_properties() | |
FlexmockContainer.reset() | |
# make sure this is done last to keep exceptions here from breaking | |
# any of the previous steps that cleanup all the changes | |
for mock_object, expectations in saved.items(): | |
for expectation in expectations: | |
> _getattr(expectation, 'verify')() | |
/usr/lib/python3.6/site-packages/flexmock.py:1180: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
/usr/lib/python3.6/site-packages/flexmock.py:620: in verify | |
(_format_args(self.name, self.args), message, self.times_called)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <flexmock.Expectation object at 0x7fbccb51a748>, exception = <class 'flexmock.MethodCallError'> | |
message = "check_call(('borg', 'check', 'repo'), stdout=<flexmock.MockClass object at 0x7fbccb51afd0>, stderr=-2) expected to be called exactly 1 times, called 0 times" | |
def __raise(self, exception, message): | |
"""Safe internal raise implementation. | |
In case we're patching builtins, it's important to reset the | |
expectation before raising any exceptions or else things like | |
open() might be stubbed out and the resulting runner errors are very | |
difficult to diagnose. | |
""" | |
self.reset() | |
> raise exception(message) | |
E flexmock.MethodCallError: check_call(('borg', 'check', 'repo'), stdout=<flexmock.MockClass object at 0x7fbccb51afd0>, stderr=-2) expected to be called exactly 1 times, called 0 times | |
/usr/lib/python3.6/site-packages/flexmock.py:349: MethodCallError | |
__________________________________________________________________________________________________________ test_check_archives_calls_borg_with_parameters[checks3] ___________________________________________________________________________________________________________ | |
def flexmock_teardown(): | |
"""Performs lexmock-specific teardown tasks.""" | |
saved = {} | |
instances = [] | |
classes = [] | |
for mock_object, expectations in FlexmockContainer.flexmock_objects.items(): | |
saved[mock_object] = expectations[:] | |
for expectation in expectations: | |
_getattr(expectation, 'reset')() | |
for mock in saved.keys(): | |
obj = mock._object | |
if not isinstance(obj, Mock) and not _isclass(obj): | |
instances.append(obj) | |
if _isclass(obj): | |
classes.append(obj) | |
for obj in instances + classes: | |
for attr in UPDATED_ATTRS: | |
try: | |
obj_dict = obj.__dict__ | |
if _get_code(obj_dict[attr]) is _get_code(Mock.__dict__[attr]): | |
del obj_dict[attr] | |
except: | |
try: | |
if _get_code(getattr(obj, attr)) is _get_code(Mock.__dict__[attr]): | |
delattr(obj, attr) | |
except AttributeError: | |
pass | |
FlexmockContainer.teardown_properties() | |
FlexmockContainer.reset() | |
# make sure this is done last to keep exceptions here from breaking | |
# any of the previous steps that cleanup all the changes | |
for mock_object, expectations in saved.items(): | |
for expectation in expectations: | |
> _getattr(expectation, 'verify')() | |
/usr/lib/python3.6/site-packages/flexmock.py:1180: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
/usr/lib/python3.6/site-packages/flexmock.py:620: in verify | |
(_format_args(self.name, self.args), message, self.times_called)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <flexmock.Expectation object at 0x7fbccb29d3c8>, exception = <class 'flexmock.MethodCallError'> | |
message = "check_call(('borg', 'check', 'repo'), stdout=<flexmock.MockClass object at 0x7fbccb29d390>, stderr=-2) expected to be called exactly 1 times, called 0 times" | |
def __raise(self, exception, message): | |
"""Safe internal raise implementation. | |
In case we're patching builtins, it's important to reset the | |
expectation before raising any exceptions or else things like | |
open() might be stubbed out and the resulting runner errors are very | |
difficult to diagnose. | |
""" | |
self.reset() | |
> raise exception(message) | |
E flexmock.MethodCallError: check_call(('borg', 'check', 'repo'), stdout=<flexmock.MockClass object at 0x7fbccb29d390>, stderr=-2) expected to be called exactly 1 times, called 0 times | |
/usr/lib/python3.6/site-packages/flexmock.py:349: MethodCallError | |
================================================================================================================== 4 failed, 166 deselected in 0.33 seconds ================================================================================================================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment