@@ -248,8 +248,9 @@ region will be excluded. If part of the region introduces a block, the entire
248248block is excluded even if part of it is outside the matched region.
249249
250250When writing regexes to match multiple lines, remember that ``"." `` won't match
251- a newline character, but ``"\n" `` or ``"(?s:.)" `` will. Using the ``"(?s)" ``
252- flag in your regex will also make dot match a newline.
251+ a newline character, but ``"\n" `` or ``"(?s:.)" `` will. The regexes in these
252+ settings are combined, so you cannot use global flags like ``(?s) `` in
253+ your regexes. Use the scoped flag form instead: ``(?s:...) ``
253254
254255Here are some examples:
255256
@@ -263,7 +264,7 @@ Here are some examples:
263264 ; 2. Comments to turn coverage on and off:
264265 no cover: start(?s:.)*?no cover: stop
265266 ; 3. A pragma comment that excludes an entire file:
266- (?s)\A .*# pragma: exclude file.*\Z
267+ \A (?s: .*# pragma: exclude file.*) \Z
267268 """,
268269 toml=r"""
269270 [tool.coverage.report]
@@ -273,7 +274,7 @@ Here are some examples:
273274 # 2. Comments to turn coverage on and off:
274275 "no cover: start(?s:.)*?no cover: stop",
275276 # 3. A pragma comment that excludes an entire file:
276- "(?s) \\A.*# pragma: exclude file.*\\Z",
277+ "\\A(?s: .*# pragma: exclude file.*) \\Z",
277278 ]
278279 """,
279280 )
@@ -291,7 +292,7 @@ Here are some examples:
291292 ; 2. Comments to turn coverage on and off:
292293 no cover: start(?s:.)*?no cover: stop
293294 ; 3. A pragma comment that excludes an entire file:
294- (?s) \A .*# pragma: exclude file.*\Z
295+ \A (?s: .*# pragma: exclude file.*) \Z
295296
296297 .. code-tab :: toml
297298 :caption: pyproject.toml
@@ -303,7 +304,7 @@ Here are some examples:
303304 # 2. Comments to turn coverage on and off:
304305 "no cover: start(?s:.)*?no cover: stop",
305306 # 3. A pragma comment that excludes an entire file:
306- "(?s) \\ A.*# pragma: exclude file.*\\ Z",
307+ "\\ A(?s: .*# pragma: exclude file.*) \\ Z",
307308 ]
308309
309310 .. code-tab :: ini
@@ -316,9 +317,9 @@ Here are some examples:
316317 ; 2. Comments to turn coverage on and off:
317318 no cover: start(?s:.)*?no cover: stop
318319 ; 3. A pragma comment that excludes an entire file:
319- (?s) \A .*# pragma: exclude file.*\Z
320+ \A (?s: .*# pragma: exclude file.*) \Z
320321
321- .. [[[end]]] (checksum: 22ff0a1433f00d3b4d13544623aaf884 )
322+ .. [[[end]]] (checksum: ee3ef14b5a5d73f987b924df623a4927 )
322323
323324 The first regex matches a specific except line followed by a specific function
324325call. Both lines must be present for the exclusion to take effect. Note that
@@ -336,7 +337,7 @@ as possible, and you could accidentally exclude large swaths of code.
336337The third regex matches the entire text of a file containing the comment ``#
337338pragma: exclude file ``. This lets you exclude files from coverage measurement
338339with an internal comment instead of naming them in a settings file. This regex
339- uses the ``"(?s)" `` regex flag to let a dot match any character including a
340+ uses the ``"(?s:... )" `` regex flag to let a dot match any character including a
340341newline.
341342
342343
0 commit comments