From 356ffd97d808d750da3380e341eeedad05d2b7dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ely=C3=A9zer=20Mendes=20Rezende?= Date: Tue, 26 Jan 2016 16:25:07 -0200 Subject: [PATCH] Remove proxy call from TestFunction This will make testimony play nice when running inside a multiprocessing environment. That proxy logic lands to a max recursion depth error when multiprocessing module is trying to pass a TestFunction instance to a process. --- testimony/__init__.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/testimony/__init__.py b/testimony/__init__.py index 4054c5f..3462a6d 100755 --- a/testimony/__init__.py +++ b/testimony/__init__.py @@ -85,9 +85,10 @@ class TestFunction(object): def __init__(self, function_def, parent_class=None, testmodule=None): #: A ``ast.FunctionDef`` instance used to extract information + self.docstring = ast.get_docstring(function_def) self.function_def = function_def + self.name = function_def.name self.parent_class = parent_class - self.docstring = ast.get_docstring(function_def) self.testmodule = testmodule self.assertion = None self.bugs = None @@ -177,14 +178,6 @@ def to_dict(self): 'test': self.test, } - def __getattr__(self, name): - """Proxy missing attributes to the ``ast.FunctionDef`` instance.""" - attr = getattr(self.function_def, name, self._undefined) - if attr is self._undefined: - return super(TestFunction, self).__getattr__(name) - else: - return attr - def __str__(self): output = [] if self.test is not None: