-
-
Notifications
You must be signed in to change notification settings - Fork 441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lambda expression confuses branch measurement #90
Comments
Original comment by Carl Meyer (Bitbucket: carljm, GitHub: carljm) I can verify that, at least in my case, the missing jump to exit disappeared when I ensured the lambda was used during the test run. Seems to me this could be considered useful coverage information, not a bug -- if anything, the branch-coverage report should special-case this to display a more informative label on the line? |
A particularly confusing form of this bug:
The "OPERATIONS = " line will have a missed branch to "exit" if the lambda expression is never executed. |
Bug #460 is related to this. |
Perhaps the best we can do here is to report it as "Missed lambda" instead of "missed branch to exit." |
It's not as good as I would like, but as of now, the HTML shows "3 ↛ exit", and the hover text reads "line 6 didn't finish the lambda on line 6". I think this provides enough information to the reader. Getting more precise would require collecting data differently, to distinguish the line 6 execution during building the list, from line 6 execution during running the lambda. We can distinguish them based on the co_firstlineno of the frame, but we don't have a way to record that data as we go. |
…p.__aexit__ types") (nedbat#90)
Has this been fixed? I'm still seeing issues. conversion_lookup: Dict[Type[Union[int, bool, float, str, Path]], Callable[[Any], str]] = {
int: str,
bool: str,
float: str,
str: str,
Path: lambda x: str(x.as_posix()),
} coverage 7.2.7 |
@sigma67 since this ticket is so old, it would be better to open a new issue with complete details of what the problem is and how to reproduce it. |
The issue was actually on my end, the lambda function in question was in fact not covered. Sorry for bothering you about it. |
A line like this:
is marked as being a branch with a missing jump to "exit", maybe only if the lambda isn't used.
The text was updated successfully, but these errors were encountered: