add kwarg support to py.errpr.checked_call
--HG-- branch : trunk
This commit is contained in:
parent
75d80ca183
commit
a07e494554
|
@ -53,11 +53,11 @@ class ErrorMaker(object):
|
|||
self._errno2class[eno] = errorcls
|
||||
return errorcls
|
||||
|
||||
def checked_call(self, func, *args):
|
||||
def checked_call(self, func, *args, **kwargs):
|
||||
""" call a function and raise an errno-exception if applicable. """
|
||||
__tracebackhide__ = True
|
||||
try:
|
||||
return func(*args)
|
||||
return func(*args, **kwargs)
|
||||
except self.Error:
|
||||
raise
|
||||
except EnvironmentError:
|
||||
|
|
|
@ -24,3 +24,8 @@ def test_error_conversion_ENOTDIR(testdir):
|
|||
assert isinstance(excinfo.value, EnvironmentError)
|
||||
assert isinstance(excinfo.value, py.error.Error)
|
||||
assert "ENOTDIR" in repr(excinfo.value)
|
||||
|
||||
|
||||
def test_checked_call_supports_kwargs(tmpdir):
|
||||
import tempfile
|
||||
py.error.checked_call(tempfile.mkdtemp, dir=str(tmpdir))
|
||||
|
|
Loading…
Reference in New Issue