Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexCLeduc committed Oct 18, 2020
1 parent 1146de7 commit 8176aea
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,36 @@ def coverage_init(reg, options):
out = self.run_command("coverage html")
self.assertEqual(out, "")

def test_omitted_traced_plugin_deps_dont_warn(self):
self.make_file("traces_own_deps_plugin.py", """\
from coverage import CoveragePlugin
import local_module
class MyPlugin(CoveragePlugin):
def file_tracer(self, filename):
if 'local_module' in filename:
return self
return None
def coverage_init(reg, options):
reg.add_noop(MyPlugin())
""")
self.make_file("local_module.py", "CONST = 1")
self.make_file(".coveragerc", """\
[run]
plugins = traces_own_deps_plugin
omit=local_module.py,traces_own_deps_plugin.py
source=.
""")
self.make_file("main_file.py", """\
import local_module
print('MAIN')
""")

out = self.run_command("coverage run main_file.py")
self.assertEqual(out, "MAIN\n")
out = self.run_command("coverage html")
self.assertEqual(out, "")


class PluginWarningOnPyTracer(CoverageTest):
"""Test that we get a controlled exception with plugins on PyTracer."""
Expand Down

0 comments on commit 8176aea

Please sign in to comment.