summaryrefslogtreecommitdiff
path: root/tests/test_plugins.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-02-09 09:41:28 -0500
committerNed Batchelder <ned@nedbatchelder.com>2015-02-09 09:41:28 -0500
commit674fbf7bfd2c60835cdc2213f2d901b97b304a8d (patch)
treeea331bc33c99f5dda81ee8b5eaf27f8efa204bd5 /tests/test_plugins.py
parente6293b0f0d8a029489a5571f39f975021c2249e8 (diff)
downloadpython-coveragepy-674fbf7bfd2c60835cdc2213f2d901b97b304a8d.tar.gz
Plugin support is now only in the CTracer, not in the PyTracer.
Diffstat (limited to 'tests/test_plugins.py')
-rw-r--r--tests/test_plugins.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
index 83dc4a1..2b4b2ee 100644
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -3,6 +3,7 @@
import os.path
import coverage
+from coverage import env
from coverage.backward import StringIO
from coverage.control import Plugins
from coverage.misc import CoverageException
@@ -198,9 +199,35 @@ class PluginTest(CoverageTest):
self.assertEqual(expected_end, out_lines[-len(expected_end):])
+class PluginWarningOnPyTracer(CoverageTest):
+ """Test that we get a controlled exception with plugins on PyTracer."""
+ def setUp(self):
+ super(PluginWarningOnPyTracer, self).setUp()
+ if env.C_TRACER:
+ self.skip("This test is only about PyTracer.")
+
+ def test_exception_if_plugins_on_pytracer(self):
+ self.make_file("simple.py", """a = 1""")
+
+ cov = coverage.Coverage()
+ cov.config["run:plugins"] = ["tests.plugin1"]
+
+ msg = (
+ r"Plugin file tracers \(tests.plugin1\) "
+ r"aren't supported with PyTracer"
+ )
+ with self.assertRaisesRegex(CoverageException, msg):
+ self.start_import_stop(cov, "simple")
+
+
class FileTracerTest(CoverageTest):
"""Tests of plugins that implement file_tracer."""
+ def setUp(self):
+ super(FileTracerTest, self).setUp()
+ if not env.C_TRACER:
+ self.skip("Plugins are only supported with the C tracer.")
+
def test_plugin1(self):
self.make_file("simple.py", """\
import try_xyz