Skip to content

Commit

Permalink
tbstyle_given
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Aug 28, 2020
1 parent 06fd491 commit 9808c46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/_pytest/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ def __init__(self, pluginmanager, *, invocation_params=None) -> None:
)

self.option = argparse.Namespace()
self._nondefault_options = set() # type: Set[str]
self.invocation_params = invocation_params

_a = FILE_OR_DIR
Expand Down Expand Up @@ -895,9 +896,10 @@ def _processopt(self, opt: "Argument") -> None:
for name in opt._short_opts + opt._long_opts:
self._opt2dest[name] = opt.dest

if hasattr(opt, "default"):
if not hasattr(self.option, opt.dest):
setattr(self.option, opt.dest, opt.default)
if hasattr(self.option, opt.dest):
self._nondefault_options.add(opt.dest)
elif hasattr(opt, "default"):
setattr(self.option, opt.dest, opt.default)

@hookimpl(trylast=True)
def pytest_load_initial_conftests(self, early_config):
Expand Down
4 changes: 2 additions & 2 deletions src/_pytest/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,11 @@ def _repr_failure_py(
return excinfo.value.formatrepr()

# XXX should excinfo.getrepr record all data and toterminal() process it?
# XXX: does not distinguish between default/unset and --tb=auto.
tbstyle = self.config.option.tbstyle
verbosity = self.config.option.verbose
if fulltrace:
style = "long" if tbstyle == "auto" else tbstyle # type: _TracebackStyle
tbstyle_given = "tbstyle" in self.config._nondefault_options
style = tbstyle if tbstyle_given else "long" # type: _TracebackStyle
else:
if tbstyle == "auto":
if default_style is None:
Expand Down

0 comments on commit 9808c46

Please sign in to comment.