diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-02-09 09:41:28 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-02-09 09:41:28 -0500 |
commit | 5f335f063449a359d855546fc3d439f24f84d466 (patch) | |
tree | b2b8917a96c622dfa53a4795d38637797b24c4c8 /tests/test_plugins.py | |
parent | b681d98fbd7b880bfaa670429db6f445f3a5fbd0 (diff) | |
download | python-coveragepy-git-5f335f063449a359d855546fc3d439f24f84d466.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.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_plugins.py b/tests/test_plugins.py index 83dc4a16..2b4b2ee1 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 |