You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I have code which is operating system dependent and hence can't be covered on a single operating system, which doesn't allow me to understand how well my code is covered on each single operating system.
That probably also encourages me to accept a lower than necessary code coverage as I can't anyway reach 100%, and don't know how much of the missing 14% are due to this issue.
Describe the solution you'd like
I'd like to have conditional # pragma: no cover, e.g. # pragma: no cover if os.name == "nt" or # pragma: cover if os.name == "nt" or # pragma: no cover if os.name != "nt" (the 2 last being equivalent). sys.platform or any equivalent approach resp. syntax would be fine.
Describe alternatives you've considered
I didn't find any alternative beside ignoring missing coverage "in my head".
Additional context https://github.com/rdiff-backup/rdiff-backup/blob/master/tox.ini shows only 86% coverage among other, because src/rdiffbackup/meta/acl_win.py is only covered at 26% and src/rdiffbackup/utils/locking.py at 36%, both being very specific to Windows (and I've completely ignored the MacOS code at src/rdiffbackup/meta/stdattr.py).
I have in mind something like @unittest.skipUnless resp. @unittest.skipIf but it doesn't need to be as flexible/dynamic.
The text was updated successfully, but these errors were encountered:
I won't be adding this as a built-in feature of coverage, but there are third-party tools that do it: https://github.com/asottile/covdefaults. You can also do this yourself in a tox.ini file or similar, by defining an environment variable based on the OS, then using that variable in your .coveragerc file to specify exclude_also patterns. (I thought I knew where an example was, but I can't find it now.)
The other thing to remember is that you can combine coverage results from multiple runs. Test on Windows and Unix, then combine the results to get the total.
Is your feature request related to a problem? Please describe.
I have code which is operating system dependent and hence can't be covered on a single operating system, which doesn't allow me to understand how well my code is covered on each single operating system.
That probably also encourages me to accept a lower than necessary code coverage as I can't anyway reach 100%, and don't know how much of the missing 14% are due to this issue.
Describe the solution you'd like
I'd like to have conditional
# pragma: no cover
, e.g.# pragma: no cover if os.name == "nt"
or# pragma: cover if os.name == "nt"
or# pragma: no cover if os.name != "nt"
(the 2 last being equivalent).sys.platform
or any equivalent approach resp. syntax would be fine.Describe alternatives you've considered
I didn't find any alternative beside ignoring missing coverage "in my head".
Additional context
https://github.com/rdiff-backup/rdiff-backup/blob/master/tox.ini shows only 86% coverage among other, because
src/rdiffbackup/meta/acl_win.py
is only covered at 26% andsrc/rdiffbackup/utils/locking.py
at 36%, both being very specific to Windows (and I've completely ignored the MacOS code atsrc/rdiffbackup/meta/stdattr.py
).I have in mind something like
@unittest.skipUnless
resp.@unittest.skipIf
but it doesn't need to be as flexible/dynamic.The text was updated successfully, but these errors were encountered: