introduce custom object for cmdline arguments

Allows to define special functions over the arguments.

Also splits CLI tests in two files as they have become too many.
This commit is contained in:
Sarah Hoffmann
2021-02-24 10:38:19 +01:00
parent f6e894a53a
commit 7222235579
6 changed files with 173 additions and 105 deletions

18
test/python/mocks.py Normal file
View File

@@ -0,0 +1,18 @@
"""
Custom mocks for testing.
"""
class MockParamCapture:
""" Mock that records the parameters with which a function was called
as well as the number of calls.
"""
def __init__(self, retval=0):
self.called = 0
self.return_value = retval
def __call__(self, *args, **kwargs):
self.called += 1
self.last_args = args
self.last_kwargs = kwargs
return self.return_value