Closed ForeverWintr closed 10 months ago
I think this is perhaps cool. But help me out. How do you see the results with -p no:terminal? I'm trying to figure out how to make sure a test run worked if there's no output.
That's a good question. I ran into this because my IDE (Wing) uses no:terminal
in its pytest integration. There it calls pytest.main
directly, so I think the goal is to disable printing entirely.
Looking at Wing's code, I think they are using a pytest plugin to gather results, so perhaps that's one option. Maybe another is to rely on return code?
I think I've found a way to test it, with --junit-xml I think it will work on released pytest as long as you don't use context managers.
Are you using helper functions?
from pytest_check import check
def test_foo():
check.equal(1, 1)
Or context managers?
from pytest_check import check
def test_foo():
with check:
assert 1 == 2
Because it looks like context managers will fail due to an issue with pytest assert rewriting and getoption("verbose")
.
I should be able to get this merged and released this week, as long as you don't rely on context manager check.
We were using context managers, but could easily switch to using helper functions. Also I've applied this patch locally, so this isn't urgent for us. :)
Thanks for taking a look at it!
Hi @okken,
Thanks for this package!
This small PR fixes an issue I encountered when running pytest with
-p no:terminal
. It seems that some of the options the plugin expects don't exist when the terminal is disabled. Here's an example of the issue:I'd be happy to add a test too, but wasn't sure where to put it. Is there an existing module you'd suggest I use?