summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--changelog/5139.bugfix.rst1
-rw-r--r--src/_pytest/config/__init__.py2
-rw-r--r--src/_pytest/nodes.py8
-rw-r--r--src/_pytest/python.py6
-rw-r--r--src/_pytest/reports.py2
-rw-r--r--testing/test_config.py11
7 files changed, 20 insertions, 11 deletions
diff --git a/AUTHORS b/AUTHORS
index ea6fc5cac..092fa2e8f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -105,6 +105,7 @@ Hugo van Kemenade
Hui Wang (coldnight)
Ian Bicking
Ian Lesperance
+Ilya Konstantinov
Ionuț Turturică
Iwan Briquemont
Jaap Broekhuizen
diff --git a/changelog/5139.bugfix.rst b/changelog/5139.bugfix.rst
new file mode 100644
index 000000000..1369d3b75
--- /dev/null
+++ b/changelog/5139.bugfix.rst
@@ -0,0 +1 @@
+Eliminate core dependency on 'terminal' plugin.
diff --git a/src/_pytest/config/__init__.py b/src/_pytest/config/__init__.py
index 4ed9deac4..d14708f63 100644
--- a/src/_pytest/config/__init__.py
+++ b/src/_pytest/config/__init__.py
@@ -699,7 +699,7 @@ class Config(object):
return self
def notify_exception(self, excinfo, option=None):
- if option and option.fulltrace:
+ if option and getattr(option, "fulltrace", False):
style = "long"
else:
style = "native"
diff --git a/src/_pytest/nodes.py b/src/_pytest/nodes.py
index fcaf59312..4dd0e1785 100644
--- a/src/_pytest/nodes.py
+++ b/src/_pytest/nodes.py
@@ -248,7 +248,7 @@ class Node(object):
if excinfo.errisinstance(fm.FixtureLookupError):
return excinfo.value.formatrepr()
tbfilter = True
- if self.config.option.fulltrace:
+ if self.config.getoption("fulltrace", False):
style = "long"
else:
tb = _pytest._code.Traceback([excinfo.traceback[-1]])
@@ -260,12 +260,12 @@ class Node(object):
style = "long"
# XXX should excinfo.getrepr record all data and toterminal() process it?
if style is None:
- if self.config.option.tbstyle == "short":
+ if self.config.getoption("tbstyle", "auto") == "short":
style = "short"
else:
style = "long"
- if self.config.option.verbose > 1:
+ if self.config.getoption("verbose", 0) > 1:
truncate_locals = False
else:
truncate_locals = True
@@ -279,7 +279,7 @@ class Node(object):
return excinfo.getrepr(
funcargs=True,
abspath=abspath,
- showlocals=self.config.option.showlocals,
+ showlocals=self.config.getoption("showlocals", False),
style=style,
tbfilter=tbfilter,
truncate_locals=truncate_locals,
diff --git a/src/_pytest/python.py b/src/_pytest/python.py
index 9e4392264..135f5bff9 100644
--- a/src/_pytest/python.py
+++ b/src/_pytest/python.py
@@ -820,7 +820,7 @@ class FunctionMixin(PyobjMixin):
self.obj = self._getobj()
def _prunetraceback(self, excinfo):
- if hasattr(self, "_obj") and not self.config.option.fulltrace:
+ if hasattr(self, "_obj") and not self.config.getoption("fulltrace", False):
code = _pytest._code.Code(get_real_func(self.obj))
path, firstlineno = code.path, code.firstlineno
traceback = excinfo.traceback
@@ -835,14 +835,14 @@ class FunctionMixin(PyobjMixin):
excinfo.traceback = ntraceback.filter()
# issue364: mark all but first and last frames to
# only show a single-line message for each frame
- if self.config.option.tbstyle == "auto":
+ if self.config.getoption("tbstyle", "auto") == "auto":
if len(excinfo.traceback) > 2:
for entry in excinfo.traceback[1:-1]:
entry.set_repr_style("short")
def repr_failure(self, excinfo, outerr=None):
assert outerr is None, "XXX outerr usage is deprecated"
- style = self.config.option.tbstyle
+ style = self.config.getoption("tbstyle", "auto")
if style == "auto":
style = "long"
return self._repr_failure_py(excinfo, style=style)
diff --git a/src/_pytest/reports.py b/src/_pytest/reports.py
index d2df4d21f..739af0783 100644
--- a/src/_pytest/reports.py
+++ b/src/_pytest/reports.py
@@ -361,7 +361,7 @@ class TestReport(BaseReport):
longrepr = item.repr_failure(excinfo)
else: # exception in setup or teardown
longrepr = item._repr_failure_py(
- excinfo, style=item.config.option.tbstyle
+ excinfo, style=item.config.getoption("tbstyle", "auto")
)
for rwhen, key, content in item._report_sections:
sections.append(("Captured %s %s" % (key, rwhen), content))
diff --git a/testing/test_config.py b/testing/test_config.py
index 68c948a41..07d0fbac5 100644
--- a/testing/test_config.py
+++ b/testing/test_config.py
@@ -770,7 +770,7 @@ def test_notify_exception(testdir, capfd):
config = testdir.parseconfig()
with pytest.raises(ValueError) as excinfo:
raise ValueError(1)
- config.notify_exception(excinfo)
+ config.notify_exception(excinfo, config.option)
out, err = capfd.readouterr()
assert "ValueError" in err
@@ -779,10 +779,17 @@ def test_notify_exception(testdir, capfd):
return True
config.pluginmanager.register(A())
- config.notify_exception(excinfo)
+ config.notify_exception(excinfo, config.option)
out, err = capfd.readouterr()
assert not err
+ config = testdir.parseconfig("-p", "no:terminal")
+ with pytest.raises(ValueError) as excinfo:
+ raise ValueError(1)
+ config.notify_exception(excinfo, config.option)
+ out, err = capfd.readouterr()
+ assert "ValueError" in err
+
def test_load_initial_conftest_last_ordering(testdir, _config_for_test):
pm = _config_for_test.pluginmanager