summaryrefslogtreecommitdiff
path: root/_pytest/_code/code.py
diff options
context:
space:
mode:
authorRonny Pfannschmidt <opensource@ronnypfannschmidt.de>2018-03-09 14:21:56 +0100
committerRonny Pfannschmidt <opensource@ronnypfannschmidt.de>2018-03-09 14:21:56 +0100
commit74884b190133c2fbf374ef206233ad045a622a89 (patch)
treee6909e8a49e58b23cb71f6ec41abaa360450e30b /_pytest/_code/code.py
parentc67f45b7166dd74c3cc8e52bf5fb86b2098456c7 (diff)
downloadpytest-74884b190133c2fbf374ef206233ad045a622a89.tar.gz
turn FormattedExcinfo into a attrs class
Diffstat (limited to '_pytest/_code/code.py')
-rw-r--r--_pytest/_code/code.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/_pytest/_code/code.py b/_pytest/_code/code.py
index 84627a435..76e143774 100644
--- a/_pytest/_code/code.py
+++ b/_pytest/_code/code.py
@@ -3,6 +3,8 @@ import inspect
import sys
import traceback
from inspect import CO_VARARGS, CO_VARKEYWORDS
+
+import attr
import re
from weakref import ref
from _pytest.compat import _PY2, _PY3, PY35, safe_str
@@ -458,19 +460,19 @@ class ExceptionInfo(object):
return True
+@attr.s
class FormattedExcinfo(object):
""" presenting information about failing Functions and Generators. """
# for traceback entries
flow_marker = ">"
fail_marker = "E"
- def __init__(self, showlocals=False, style="long", abspath=True, tbfilter=True, funcargs=False):
- self.showlocals = showlocals
- self.style = style
- self.tbfilter = tbfilter
- self.funcargs = funcargs
- self.abspath = abspath
- self.astcache = {}
+ showlocals = attr.ib(default=False)
+ style = attr.ib(default="long")
+ abspath = attr.ib(default=True)
+ tbfilter = attr.ib(default=True)
+ funcargs = attr.ib(default=False)
+ astcache = attr.ib(default=attr.Factory(dict), init=False, repr=False)
def _getindent(self, source):
# figure out indent for given source