File tree Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Expand file tree Collapse file tree 4 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,11 @@ upgrading your version of coverage.py.
23
23
Unreleased
24
24
----------
25
25
26
- Nothing yet.
26
+ - Fix: setting ``COVERAGE_CORE=sysmon `` no longer errors on 3.11 and lower,
27
+ thanks `Hugo van Kemenade <pull 1747 _>`_. It now issues a warning that
28
+ sys.monitoring is not available and falls back to the default core instead.
29
+
30
+ .. _pull 1747 : https://github.com/nedbat/coveragepy/pull/1747
27
31
28
32
29
33
.. scriv-start-here
Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ def __init__(
152
152
core = os .getenv ("COVERAGE_CORE" )
153
153
154
154
if core == "sysmon" and not env .PYBEHAVIOR .pep669 :
155
+ self .warn ("sys.monitoring isn't available, using default core" , slug = "no-sysmon" )
155
156
core = None
156
157
157
158
if not core :
Original file line number Diff line number Diff line change @@ -273,6 +273,11 @@ Conflicting dynamic contexts (dynamic-conflict)
273
273
:meth: `.Coverage.switch_context ` function to change the context. Only one of
274
274
these mechanisms should be in use at a time.
275
275
276
+ sys.monitoring isn't available, using default core (no-sysmon)
277
+ You requested to use the sys.monitoring measurement core, but are running on
278
+ Python 3.11 or lower where it isn't available. A default core will be used
279
+ instead.
280
+
276
281
Individual warnings can be disabled with the :ref: `disable_warnings
277
282
<config_run_disable_warnings>` configuration setting. To silence "No data was
278
283
collected," add this to your configuration file:
Original file line number Diff line number Diff line change @@ -1129,10 +1129,13 @@ def test_core_request_sysmon(self) -> None:
1129
1129
out = self .run_command ("coverage run --debug=sys numbers.py" )
1130
1130
assert out .endswith ("123 456\n " )
1131
1131
core = re_line (r" core:" , out ).strip ()
1132
+ warns = re_lines (r"CoverageWarning: sys.monitoring isn't available" , out )
1132
1133
if env .PYBEHAVIOR .pep669 :
1133
1134
assert core == "core: SysMonitor"
1135
+ assert not warns
1134
1136
else :
1135
1137
assert core in ("core: CTracer" , "core: PyTracer" )
1138
+ assert warns
1136
1139
1137
1140
1138
1141
class FailUnderNoFilesTest (CoverageTest ):
You can’t perform that action at this time.
0 commit comments