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 <[email protected]>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

_______________________________________________
Mailman-Developers mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/mailman-developers.python.org/
Mailman FAQ: https://wiki.list.org/x/AgA3

Security Policy: https://wiki.list.org/x/QIA9

Reply via email to