astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.6k stars 466 forks source link

Pass coverage related arguments to pytest #1146

Open m-rph opened 3 months ago

m-rph commented 3 months ago

Hello,

Thank you for the project!

I have a feature request:

I'd like to be able to pass additional coverage related flags when running tests. In particular, I'd like --cov [package], --cov-report, --cov-fail-under.

Alternatively, I'd like if possible to be able to just pass whatever subsequent arguments and just forward them to pytest.

m-rph commented 3 months ago

By the way, I wouldn't mind implementing this if the bandwidth isn't here.

my1e5 commented 3 months ago

Isn't this already possible? See https://rye.astral.sh/guide/commands/test/ and [EXTRA_ARGS]...

Also you can add extra args in your pyproject.toml file. For example

[tool.pytest.ini_options]
addopts = "--cov=myproject --cov-report html"
m-rph commented 3 months ago

Ugh, that's right, I missed the -- part— this is embarrassing... Feel free to close then.