pytest-trio
pytest-trio copied to clipboard
Handle unittest-based tests
As discussed here: https://github.com/python-trio/trio/issues/838
Pytest has support for running unittest-based tests. But, if you try to combine pytest, pytest-trio, and a unittest.TestCase with an async test method, it doesn't work – somehow pytest-trio can't "see through" whatever the TestCase is doing. It would be kinda nice if it did work.
I don't know how urgent this is. Possibly not very. But since we did run into it and do some research, I figured I should write that down.
If this affects you then commenting here would be helpful to let us know.
I use unittest with trio, and don't plan to ever migrate to pytest. It would be nice to be able to get rid of my homegrown TrioTestCase in favor of pytest-trio or something else.
@catern can you explain more what you mean about not wanting to switch to pytest, but wanting to use pytest-trio? What parts of pytest are you trying to avoid?
The test definition part - the part that allows defining tests as free functions, supplying mocks, and using assert. But I'm fine with using the pytest runner to run my tests defined with unittest, if that's the upstream-supported way to use unittest.