curio icon indicating copy to clipboard operation
curio copied to clipboard

Support stdlib unittest

Open logileifs opened this issue 2 years ago • 4 comments

I've noticed that the recommended way to write tests for curio programs is to use pytest and install the curio plugin. I prefer to just stick to the unittest library from the standard library so to be able to run curio tests without pytest I created a CurioTestCase class which mimics the IsolatedAsyncioTestCase included with unittest. It works with both pytest and pure unittest. I already created a pull request but I thought it would be good to open an issue as well for visibility/discussion.

logileifs avatar Nov 24 '22 20:11 logileifs

There's a recommended way to write tests? Where is this documented?

dabeaz avatar Nov 24 '22 20:11 dabeaz

Well maybe not recommended but judging by the issues (https://github.com/dabeaz/curio/issues/330 for example) it seems to be the standard way to write tests for curio programs.

logileifs avatar Nov 24 '22 20:11 logileifs

I don't have any official recommendation regarding the testing of Curio programs. The test suite uses pytest, but it doesn't rely upon any plugins to my knowledge.

dabeaz avatar Nov 24 '22 20:11 dabeaz

Anyway, I think this would only make curio easier and more approachable. If you don't agree then feel free to close this.

logileifs avatar Nov 24 '22 20:11 logileifs