Open flixman opened 1 year ago
I have checked the plugin starting the subprocess, (pytest-flask, file live_server.py) and it sends a SIGINT to the process before calling the join (which seems to be aligned with coverage recommendations).
Have you tried setting the [run] sigterm = true
setting? (docs)
Hi @nedbat Indeed, this is my .coveragerc:
[run]
branch = true
parallel = true
concurrency = multiprocessing
sigterm = true
omit =
backend/tests/*
backend/blueprints/test.py
backend/blueprints/checkout.py
[report]
fail_under = 90
show_missing = True
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
# Don't complain about missing debug-only code:
def __repr__
if self\.debug
# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
# Don't complain about abstract methods, they aren't run:
@(abc\.)?abstractmethod
Is there any way, if I set up a breakpoint inside the subprocess, to confirm that coverage is working there?
Check if the server is started with debug=True
: that can run your code inside a debugger, which interferes with coverage.py data collection. See #1663.
Describe the bug In my flask project, running through pytest with the pytest-flask plugin, a subprocess gets started. I get two .coverage..* files that get generated, but the report shows lines as missing. If I run the same tests on a debugger and set a breakpoint there, those lines are hit... but still report missing.
UPDATE: There is one of the methods on a specific file in which a single line is reported missing (out of 5). I have checked the plugin starting the subprocess, (pytest-flask, file live_server.py) and it sends a SIGINT to the process before calling the join (which seems to be aligned with coverage recommendations).
To Reproduce How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions below:
Expected behavior I get the information related to the coverage of the statements run by the subprocess that is running the flask server.