From c89827b9f2b42352a388fa1a013f6b51d0f33cb8 Mon Sep 17 00:00:00 2001 From: Ofir Date: Tue, 19 Sep 2017 15:23:07 +0300 Subject: [PATCH] updating import plugin error test in order to make sure it also checks that the original traceback has been shown to the users --- testing/test_pluginmanager.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/testing/test_pluginmanager.py b/testing/test_pluginmanager.py index 2838f83c5..55e2ea10f 100644 --- a/testing/test_pluginmanager.py +++ b/testing/test_pluginmanager.py @@ -199,12 +199,17 @@ def test_importplugin_error_message(testdir, pytestpm): testdir.syspathinsert(testdir.tmpdir) testdir.makepyfile(qwe=""" # encoding: UTF-8 - raise ImportError(u'Not possible to import: ☺') + def test_traceback(): + raise ImportError(u'Not possible to import: ☺') + test_traceback() """) with pytest.raises(ImportError) as excinfo: pytestpm.import_plugin("qwe") - expected = '.*Error importing plugin "qwe": Not possible to import: .' - assert py.std.re.match(expected, str(excinfo.value)) + + expected_message = '.*Error importing plugin "qwe": Not possible to import: .' + expected_traceback = ".*in test_traceback" + assert py.std.re.match(expected_message, str(excinfo.value)) + assert py.std.re.match(expected_traceback, str(excinfo.traceback[-1])) class TestPytestPluginManager(object):