From 224b3a2eda73617b681005409382454f0ac12e93 Mon Sep 17 00:00:00 2001 From: uweschmitt Date: Mon, 11 Aug 2014 12:57:47 +0200 Subject: [PATCH] hopefully final fix for strange infinite recursion bug --- _pytest/capture.py | 2 ++ _pytest/main.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/_pytest/capture.py b/_pytest/capture.py index 164d5538b..1f4762b06 100644 --- a/_pytest/capture.py +++ b/_pytest/capture.py @@ -240,6 +240,8 @@ class EncodedFile(object): def __getattr__(self, name): if hasattr(self, "buffer"): return getattr(self.buffer, name) + else: + raise AttributeError("attribute buffer of %r not set" % self) class MultiCapture(object): diff --git a/_pytest/main.py b/_pytest/main.py index cbe2fabda..1be074243 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -159,6 +159,8 @@ class HookProxy: self.config = config def __getattr__(self, name): + if not hasattr(self, "config"): + raise AttributeError("attribute config of %r not set" % self) hookmethod = getattr(self.config.hook, name) def call_matching_hooks(**kwargs):