@@ -144,6 +144,14 @@ all of them by adding a regex to the exclusion list:
144144 exclude_also =
145145 def __repr__
146146
147+ .. code-tab :: toml
148+ :caption: .coveragerc.toml
149+
150+ [tool.coverage.report]
151+ exclude_also = [
152+ "def __repr__",
153+ ]
154+
147155 .. code-tab :: toml
148156 :caption: pyproject.toml
149157
@@ -159,7 +167,7 @@ all of them by adding a regex to the exclusion list:
159167 exclude_also =
160168 def __repr__
161169
162- .. [[[end]]] (sum: 8+cOvxKPvv )
170+ .. [[[end]]] (sum: 4lYsdpcbf/ )
163171
164172 For example, here's a list of exclusions I've used:
165173
@@ -215,6 +223,23 @@ For example, here's a list of exclusions I've used:
215223 class .*\b Protocol\) :
216224 @(abc\. )?abstractmethod
217225
226+ .. code-tab :: toml
227+ :caption: .coveragerc.toml
228+
229+ [tool.coverage.report]
230+ exclude_also = [
231+ 'def __repr__',
232+ 'if self.debug:',
233+ 'if settings.DEBUG',
234+ 'raise AssertionError',
235+ 'raise NotImplementedError',
236+ 'if 0:',
237+ 'if __name__ == .__main__.:',
238+ 'if TYPE_CHECKING:',
239+ 'class .*\b Protocol\) :',
240+ '@(abc\. )?abstractmethod',
241+ ]
242+
218243 .. code-tab :: toml
219244 :caption: pyproject.toml
220245
@@ -248,7 +273,7 @@ For example, here's a list of exclusions I've used:
248273 class .*\b Protocol\) :
249274 @(abc\. )?abstractmethod
250275
251- .. [[[end]]] (sum: ZQsgnt0nES )
276+ .. [[[end]]] (sum: +D/FLd6oVC )
252277
253278 The :ref: `config_report_exclude_also ` option adds regexes to the built-in
254279default list so that you can add your own exclusions. The older
@@ -318,6 +343,19 @@ Here are some examples:
318343 ; 3. A pragma comment that excludes an entire file:
319344 \A (?s:.*# pragma: exclude file.*)\Z
320345
346+ .. code-tab :: toml
347+ :caption: .coveragerc.toml
348+
349+ [tool.coverage.report]
350+ exclude_also = [
351+ # 1. Exclude an except clause of a specific form:
352+ 'except ValueError:\n\s *assume\( False\) ',
353+ # 2. Comments to turn coverage on and off:
354+ 'no cover: start(?s:.)*?no cover: stop',
355+ # 3. A pragma comment that excludes an entire file:
356+ '\A (?s:.*# pragma: exclude file.*)\Z ',
357+ ]
358+
321359 .. code-tab :: toml
322360 :caption: pyproject.toml
323361
@@ -343,7 +381,7 @@ Here are some examples:
343381 ; 3. A pragma comment that excludes an entire file:
344382 \A (?s:.*# pragma: exclude file.*)\Z
345383
346- .. [[[end]]] (sum: xG6Bmtmh06 )
384+ .. [[[end]]] (sum: eg9c8WbMqW )
347385
348386 The first regex matches a specific except line followed by a specific function
349387call. Both lines must be present for the exclusion to take effect. Note that
0 commit comments