Question Regarding Test Coverage Pipeline Error
Hello Developers,
I have a question and hope you can help me understand this issue.
I am receiving the following pipeline error <https://gitlab.com/itsPronay/mailman/-/jobs/13246197389>:
“src/mailman/interfaces/bans.py (100%) src/mailman/model/bans.py (90.0%): Missing lines 124”
Previously, I was not getting this error. The pipeline failure only started appearing after I rebased my branch with master. Why was I not getting this error before but now? Everything is the same (other than the bans.rst file) 2.
As mentioned in the error, it says that test coverage is missing for line 124 in the bans.py file. However, lines 110 and 124 are the same. I would like to understand why I am not getting an error for line 110, even though I am getting one for line 124.
I have attached screenshots for reference.
These questions might be very basic, but I would really appreciate understanding why this is happening, as I have switched to Python recently.
Thank you
Pronay [image: image.png][image: image.png]
So it is saying, What I would like to understand is,
--
251/A and 252, Tejgaon Industrial Area, Dhaka - 1208, Bangladesh. Mob: 019117-81327, 01766-348518 Web: www.seu.edu.bd <https://www.seu.edu.bd>, Email: info@seu.edu.bd <mailto:info@seu.edu.bd>
On 2/24/26 11:09, Pronay Sarker via Mailman-Developers wrote:
Hello Developers,
I have a question and hope you can help me understand this issue.
I am receiving the following pipeline error <https://gitlab.com/itsPronay/mailman/-/jobs/13246197389>:
“src/mailman/interfaces/bans.py (100%) src/mailman/model/bans.py (90.0%): Missing lines 124”
1. Previously, I was not getting this error. The pipeline failure only started appearing after I rebased my branch with master. Why was I not getting this error before but now? Everything is the same (other than the bans.rst file) 2. As mentioned in the error, it says that test coverage is missing for line 124 in the bans.py file. However, lines 110 and 124 are the same. I would like to understand why I am not getting an error for line 110, even though I am getting one for line 124.
Because the full test suite hits line 110 but not line 124. I.e, there
is some test that calls the is_banned() method with an address that
matches a pattern (beginning with ^) in the global ban list, but there
is no test for the is_banned_globaly() method with a pattern. However,
this is clearly wrong as your added test_is_banned_globally_with_pattern
test in src/mailman/model/tests/test_bans.py does cover that line, so
this appears to be a case of diff_cover failing. You can work around
this by appending # pragma: nocover to line 124.
I have attached screenshots for reference.
Which are unnecessary and just add clutter. You already gave a url to the failing test, so the screenshot of the failure is redundant and the code is in your MR so we don't need a screenshot of it.
These questions might be very basic, but I would really appreciate understanding why this is happening, as I have switched to Python recently.
diff_cover is imperfect. Very occasionally, it misses. It is unclear
why, but in those rare cases adding # pragma: nocover to the not
really missing line will work around it.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mark Sapiro wrote:
diff_cover is imperfect. Very occasionally, it misses. It is unclear why, but in those rare cases adding # pragma: nocover to the not really missing line will work around it.
And it turns out the issue was transient as when I merged the MR the pipeline passed without this issue.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
Mark Sapiro -
Pronay Sarker