From a07e4945544b2612283275111c4ed75ae08943a3 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Thu, 3 Jun 2010 10:21:48 +0200 Subject: [PATCH] add kwarg support to py.errpr.checked_call --HG-- branch : trunk --- py/_error.py | 4 ++-- testing/root/test_error.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/py/_error.py b/py/_error.py index 2f1d9e3a0..bd183e0db 100644 --- a/py/_error.py +++ b/py/_error.py @@ -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: diff --git a/testing/root/test_error.py b/testing/root/test_error.py index 2450b171f..1b9cf70ef 100644 --- a/testing/root/test_error.py +++ b/testing/root/test_error.py @@ -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))