Code is tested but not covered by codecov

Description

codecov: https://codecov.io/gh/liuxuan30/TelloSwift/pull/5/diff

So in my PR, I added a specific unit test testDeinit() for testing deinit();

I can confirm that the deinit() diff has been 100% tested, I can see breakpoints hit as well as test logs showing the missing covered code is run.

You can see the log here:https://github.com/liuxuan30/TelloSwift/pull/5/checks?check_run_id=361723920

Search “Detect timer in use yet invalidated”, and it will guide you to the specific test log

You can see the test log shows:

[TELLO-FREE-]
[TELLO-DESTROYED-]
[TELLO-FREE-]
[TELLO-FREE-] MUST CALL shutdown() first, trying to close the channel only, event group may escape
[TELLO-FREE-]
[TELLO-FREE-] Detect timer in use yet invalidated
[TELLO-FREE-] MUST CALL shutdown() first, trying to close the channel only, event group may escape

which means, all the if condition in deinit() is hit, so it should be 100% covered.

To be clear,
diff: https://codecov.io/gh/liuxuan30/TelloSwift/src/c4092d8a6e6bc4b7f66ad4ad0cfb5fe5bd45a7aa/TelloSwift/Tello.swift
TelloSwift.swift line 82 - 83, 86-89 should be hit, not missing.

I’m not sure why codecov would think it’s not covered, while it has been tested.

Description of the issue

Repository

Steps to Reproduce

Run the test testDeinit(), make sure deinit() is tested
check codecov report, it says deinit diff is not covered in full.

Expected behavior: [What you expect to happen]
deinit() diff should be 100% covered.
Actual behavior: [What actually happens]
deinit() diff is not covered

I wonder no one watches this community? Or everyone is enjoying the holidays?

The holidays :slight_smile:

Lets take a look here. The raw uploaded report for c4092d8a6e6bc4b7f66ad4ad0cfb5fe5bd45a7aa is codecov.io/codecov/v4/raw/2019-12-24/BDC9EC53796A9D0D823D57752C39E37A/c4092d8a6e6bc4b7f66ad4ad0cfb5fe5bd45a7aa/0c7ae859-ccfb-4b04-a250-51d6e1928744.txt

I don’t see Tello.swift anywhere in that report.

We also have codecov.io/codecov/v4/raw/2019-12-24/BDC9EC53796A9D0D823D57752C39E37A/c4092d8a6e6bc4b7f66ad4ad0cfb5fe5bd45a7aa/8c5fa351-1595-4219-b34d-278a4d00b6b9.txt

This one does contain Tello.swift

If you look at the report you uploaded, you can see that those lines for that file have a hit count of 0 (second column) This indicates your coverage reported is not considering those lines hit. Codecov can only parse what we are given

Hi @drazisil

Thanks for taking a look.

So I assume the raw coverage input file is generated by Xcode/Apple? I do see the hit count of the code is 0, however, the hit count of the whole corresponding unit test testDeinit() is 1, meaning the tests have been run, yet the code itself is not covered, it’s kind of paradox.

Also, I found there are areas that the tests have been run but not covered, I can clearly see the test printing logs, however it’s not covered as well. I guess it’s not a single case, this is either a bug of coverage or deinit code is not correctly parsed problem?

I understand it’s not your fault, so I should turn to Apple for this issue/bug?

Yes, please. I know we are working with Apple to fix code coverage after the latest Xcode version, I think that wrong/missing line-level coverage is one of the issues.