diff options
-rw-r--r-- | coverage/tracer.c | 6 | ||||
-rw-r--r-- | tests/test_plugins.py | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/coverage/tracer.c b/coverage/tracer.c index fe40fc67..875bfea6 100644 --- a/coverage/tracer.c +++ b/coverage/tracer.c @@ -647,6 +647,8 @@ CTracer_disable_plugin(CTracer *self, PyObject * disposition) PyObject * msg = NULL; PyObject * ignored = NULL; + PyErr_Print(); + file_tracer = PyObject_GetAttrString(disposition, "file_tracer"); if (file_tracer == NULL) { goto error; @@ -664,7 +666,7 @@ CTracer_disable_plugin(CTracer *self, PyObject * disposition) goto error; } msg = MyText_FromFormat( - "Disabling plugin '%s' due to an exception:", + "Disabling plugin '%s' due to previous exception", MyText_AsString(plugin_name) ); if (msg == NULL) { @@ -675,8 +677,6 @@ CTracer_disable_plugin(CTracer *self, PyObject * disposition) goto error; } - PyErr_Print(); - /* Disable the plugin for future files, and stop tracing this file. */ if (PyObject_SetAttrString(plugin, "_coverage_enabled", Py_False) < 0) { goto error; diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 69e7b42b..18edf66f 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -481,7 +481,11 @@ class BadPluginTest(FileTracerTest): self.assertEqual(errors, 1) # There should be a warning explaining what's happening, but only one. - msg = "Disabling plugin %r due to an exception:" % plugin_name + # The message can be in two forms: + # Disabling plugin '...' due to previous exception + # or: + # Disabling plugin '...' due to an excepton: + msg = "Disabling plugin %r due to " % plugin_name warnings = stderr.count(msg) self.assertEqual(warnings, 1) |