pytest-trio icon indicating copy to clipboard operation
pytest-trio copied to clipboard

Handle unittest-based tests

Open njsmith opened this issue 6 years ago • 3 comments

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.

njsmith avatar Jan 06 '19 16:01 njsmith

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 avatar Sep 06 '20 02:09 catern

@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?

njsmith avatar Sep 07 '20 06:09 njsmith

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.

catern avatar Sep 07 '20 13:09 catern