Skip to content
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

Conditional does not work when the .coveragerc file is NOT at the project root #189

Open
sagshome opened this issue Dec 23, 2022 · 3 comments

Comments

@sagshome
Copy link

Here is my rule:

[coverage_conditional_plugin]
rules =
"platform_system == 'Windows'": escape_win

Here is my code:
if remove:
try:
self.de_register(silent=True)
os.unlink(self.path)
except OSError as error: # pragma: escape_win
logger.debug('%s could not be removed (%s)', self.path, error)

This is my environment:

get_env_info()['platform_system']
'Windows'

@inorton
Copy link

inorton commented Dec 31, 2022

I just found out that the match means "no cover if" eg:

rules =
    "platform_system == 'Windows'":  windows

means: "no cover if on windows"

@sagshome
Copy link
Author

I just found out that the match means "no cover if" eg:

rules =
    "platform_system == 'Windows'":  windows

means: "no cover if on windows"

Agreed, that is why I named it escape_win, I don't want that code fragment counted if I am on Windows.

@sagshome
Copy link
Author

sagshome commented Jun 3, 2023

Just as a follow up. I thought I would upgrade to see if that solved my issue. Still no luck, however - if I move my .coveragerc file to the root of my project it works. I guess I will live with that for now. I will change the title of this issue

@sagshome sagshome changed the title Conditional does not appear to work with platform_system Conditional does not work when the .coveragerc file is NOT at the project root Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants