refine printing of exceptions via the pluginmanager.
if there is no pytest_internalerror() hook acknowledging receival we print the exception to sys.stderr. This helps to see issues when there are failures in TerminalReporter initialization. --HG-- branch : trunk
This commit is contained in:
@@ -214,6 +214,21 @@ class TestBootstrapping:
|
||||
for name in 'xyz', 'pytest_xyz', 'pytest_Xyz', 'Xyz':
|
||||
impname = canonical_importname(name)
|
||||
|
||||
def test_notify_exception(self, capfd):
|
||||
pp = PluginManager()
|
||||
excinfo = py.test.raises(ValueError, "raise ValueError(1)")
|
||||
pp.notify_exception(excinfo)
|
||||
out, err = capfd.readouterr()
|
||||
assert "ValueError" in err
|
||||
class A:
|
||||
def pytest_internalerror(self, excrepr):
|
||||
return True
|
||||
pp.register(A())
|
||||
pp.notify_exception(excinfo)
|
||||
out, err = capfd.readouterr()
|
||||
assert not err
|
||||
|
||||
|
||||
class TestPytestPluginInteractions:
|
||||
|
||||
def test_addhooks_conftestplugin(self, testdir):
|
||||
|
||||
Reference in New Issue
Block a user