-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
context labelled differently #901
Comments
There's no single definition of what the context labels should be. The built-in "test_function" uses one style, and the pytest plugin uses another more elaborate style. I hadn't thought much about the situation where two different mechanisms are trying to set contexts. Maybe there could be some error handling or warnings in that case? |
a warning sounds reasonable to me. happy to have a first pass at a pr (warning if setting a context means overriding on already set). does coverage already have a warnings system you could point me to? |
There is a warnings facility, for example: coveragepy/coverage/control.py Lines 701 to 702 in cecc5dd
But off the top of my head, I'm not sure how this will work. pytest-cov sets a context by calling |
ah, i thought the api might have been enter/exit context perhaps this is more of a documentation issue, e.g. recommending test runnings/plugins over maybe most of my confusion is from following the alphas, and picking up the |
@nedbat having re-read the docs i'm happy to close this unless you think any action is needed |
I added a warning for this case in 16ef35f. |
This is now available in coverage 5.0.2 |
pytest --cov=test_foo --cov-context=test; coverage report --contexts=test_foo
environ identical to #900
setting
dynamic_context = test_function
in.coveragerc
, i get context reported astest_foo.test_foo
but without that setting, the context is reported as
test_foo.py::test_foo|run
The text was updated successfully, but these errors were encountered: