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

Coverage omit argument not being passed to poe #264

Open
ddc opened this issue Dec 17, 2024 · 3 comments
Open

Coverage omit argument not being passed to poe #264

ddc opened this issue Dec 17, 2024 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@ddc
Copy link

ddc commented Dec 17, 2024

Steps to reproduce:
Use the --omit argument along with the character * to coverage run command

pyproject.toml

[tool.poe.tasks]
test = "coverage run --omit=tests/* -m pytest -v"

Output:

ddc@local:$ poe test
Poe => coverage run --m pytest -v
@nat-n
Copy link
Owner

nat-n commented Dec 19, 2024

Hi @ddc, thanks for raising this. Looks like a bug in the the shell command parsing.

I'll look into fixing this when I have some time, but in the mean time It'll probably work expected for you if instead you do --omit tests/*.

@nat-n nat-n added the bug Something isn't working label Dec 19, 2024
@ddc
Copy link
Author

ddc commented Dec 19, 2024

Hi!
Another workaround for this is to have the coverage run inside the pyproject.toml

[tool.coverage.run]
omit = [
    "tests/*"
]

@nat-n
Copy link
Owner

nat-n commented Dec 27, 2024

Hi @ddc, I just got around to properly looking at this, and I realised that this is actually expected behavior.

Although I don't blame you for finding it surprising, it's been brought up before: #234 #191

The issue is that poe parses the command using a subset of bash syntax, so the word --omit=tests/* is interpreted as a glob pattern, which in this case doesn't match anything. Where Poe the Poet diverges from bash is that when a pattern has no matches it is still replaced with the set of matches (i.e. nothing), instead of being preserved. This arguably makes more sense – although does seem to be surprising.

So after three issues being opened on the topic I'm starting to think it would be better to make the breaking change to behave more like bash.

Fortunately you can also escape the glob character exactly as you would in bash, by enclosing it in single or double quotes, or preceding it with a backslash. e.g. --omit=tests/'*', --omit="tests/*", --omit=tests/\*, etc

I'll leave this issue open for now as an enhancement request to make poe behave more like bash concerning non-matching glob patterns.

@nat-n nat-n added enhancement New feature or request and removed bug Something isn't working labels Dec 27, 2024
@nat-n nat-n added this to the 1.0.0 milestone Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants