@@ -97,16 +97,47 @@ def test_custom_exclude_patterns(self):
9797 {% lorem %}{# I'm covered! #}
9898 After
9999 """ )
100+ self .make_file (
101+ ".coveragerc" ,
102+ """\
103+ [run]
104+ plugins = django_coverage_plugin
105+ [report]
106+ exclude_lines =
107+ noqa: no-cover
108+ !SKIP ME!
109+ """ ,
110+ )
100111 tem = get_template (self .template_file )
101112 self .cov = coverage .Coverage (source = ["." ])
102- self .append_config ("run:plugins" , "django_coverage_plugin" )
103- # Set the exclude_lines with own patterns.
104- self .cov .config .set_option (
105- "report:exclude_lines" ,
106- ["noqa: no-cover" , "!SKIP ME!" ],
107- )
108113 self .cov .start ()
109114 tem .render ({"condition" : True , "content" : "hi" })
110115 self .cov .stop ()
111116 self .cov .save ()
112117 self .assert_analysis ([1 , 5 , 7 , 9 , 10 ], missing = [7 ]) # Expecting 1 missing line
118+
119+ def test_exclude_also (self ):
120+ """Test that report:exclude_also patterns are picked up."""
121+ self .make_template ("""\
122+ Before
123+ {% if condition %}{# custom-exclude #}
124+ {{ content }}
125+ {% endif %}
126+ After
127+ """ )
128+ self .make_file (
129+ ".coveragerc" ,
130+ """\
131+ [run]
132+ plugins = django_coverage_plugin
133+ [report]
134+ exclude_also = custom-exclude
135+ """
136+ )
137+ tem = get_template (self .template_file )
138+ self .cov = coverage .Coverage (source = ["." ])
139+ self .cov .start ()
140+ tem .render ({"condition" : True , "content" : "hi" })
141+ self .cov .stop ()
142+ self .cov .save ()
143+ self .assert_analysis ([1 , 5 ])
0 commit comments