From 9e3cd037213ffd4ce656c6901bd2006371360a20 Mon Sep 17 00:00:00 2001 From: maho Date: Wed, 8 May 2013 17:01:20 +0200 Subject: [PATCH] #299 - polishing --- _pytest/runner.py | 3 ++- testing/test_terminal.py | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/_pytest/runner.py b/_pytest/runner.py index 3c491cd29..763f695ce 100644 --- a/_pytest/runner.py +++ b/_pytest/runner.py @@ -198,7 +198,8 @@ def pytest_runtest_makereport(item, call): if call.when == "call": longrepr = item.repr_failure(excinfo) else: # exception in setup or teardown - longrepr = item._repr_failure_py(excinfo,style=item.config.option.tbstyle) + longrepr = item._repr_failure_py(excinfo, + style=item.config.option.tbstyle) return TestReport(item.nodeid, item.location, keywords, outcome, longrepr, when, duration=duration) diff --git a/testing/test_terminal.py b/testing/test_terminal.py index e6977c457..bdafe27c1 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -665,3 +665,19 @@ def test_fdopen_kept_alive_issue124(testdir): result.stdout.fnmatch_lines([ "*2 passed*" ]) + + +def test_tbstyle_native_setup_error(testdir): + p = testdir.makepyfile(""" + import pytest + @pytest.fixture + def setup_error_fixture(): + raise Exception("error in exception") + + def test_error_fixture(setup_error_fixture): + pass + """) + result = testdir.runpytest("--tb=native") + result.stdout.fnmatch_lines([ + '*File *test_tbstyle_native_setup_error.py", line *, in setup_error_fixture*' + ])