@@ -143,6 +143,14 @@ all of them by adding a regex to the exclusion list:
143143 exclude_also =
144144 def __repr__
145145
146+ .. code-tab :: toml
147+ :caption: .coveragerc.toml
148+
149+ [tool.coverage.report]
150+ exclude_also = [
151+ "def __repr__",
152+ ]
153+
146154 .. code-tab :: toml
147155 :caption: pyproject.toml
148156
@@ -158,7 +166,7 @@ all of them by adding a regex to the exclusion list:
158166 exclude_also =
159167 def __repr__
160168
161- .. [[[end]]] (sum: 8+cOvxKPvv )
169+ .. [[[end]]] (sum: 4lYsdpcbf/ )
162170
163171 For example, here's a list of exclusions I've used:
164172
@@ -214,6 +222,23 @@ For example, here's a list of exclusions I've used:
214222 class .*\b Protocol\) :
215223 @(abc\. )?abstractmethod
216224
225+ .. code-tab :: toml
226+ :caption: .coveragerc.toml
227+
228+ [tool.coverage.report]
229+ exclude_also = [
230+ 'def __repr__',
231+ 'if self.debug:',
232+ 'if settings.DEBUG',
233+ 'raise AssertionError',
234+ 'raise NotImplementedError',
235+ 'if 0:',
236+ 'if __name__ == .__main__.:',
237+ 'if TYPE_CHECKING:',
238+ 'class .*\b Protocol\) :',
239+ '@(abc\. )?abstractmethod',
240+ ]
241+
217242 .. code-tab :: toml
218243 :caption: pyproject.toml
219244
@@ -247,7 +272,7 @@ For example, here's a list of exclusions I've used:
247272 class .*\b Protocol\) :
248273 @(abc\. )?abstractmethod
249274
250- .. [[[end]]] (sum: ZQsgnt0nES )
275+ .. [[[end]]] (sum: +D/FLd6oVC )
251276
252277 The :ref: `config_report_exclude_also ` option adds regexes to the built-in
253278default list so that you can add your own exclusions. The older
@@ -317,6 +342,19 @@ Here are some examples:
317342 ; 3. A pragma comment that excludes an entire file:
318343 \A (?s:.*# pragma: exclude file.*)\Z
319344
345+ .. code-tab :: toml
346+ :caption: .coveragerc.toml
347+
348+ [tool.coverage.report]
349+ exclude_also = [
350+ # 1. Exclude an except clause of a specific form:
351+ 'except ValueError:\n\s *assume\( False\) ',
352+ # 2. Comments to turn coverage on and off:
353+ 'no cover: start(?s:.)*?no cover: stop',
354+ # 3. A pragma comment that excludes an entire file:
355+ '\A (?s:.*# pragma: exclude file.*)\Z ',
356+ ]
357+
320358 .. code-tab :: toml
321359 :caption: pyproject.toml
322360
@@ -342,7 +380,7 @@ Here are some examples:
342380 ; 3. A pragma comment that excludes an entire file:
343381 \A (?s:.*# pragma: exclude file.*)\Z
344382
345- .. [[[end]]] (sum: xG6Bmtmh06 )
383+ .. [[[end]]] (sum: eg9c8WbMqW )
346384
347385 The first regex matches a specific except line followed by a specific function
348386call. Both lines must be present for the exclusion to take effect. Note that
0 commit comments