pytest-trio
                                
                                
                                
                                    pytest-trio copied to clipboard
                            
                            
                            
                        Pytest plugin for trio
Upsides: * Can make test setup/teardown faster * Since we have to run fixtures in independent tasks anyway (see #55), running them concurrently was easier than running them sequentially. Counterarguments:...
Async fixtures defined with `autouse` aren't automatically used. E.g. ``` @pytest.fixture(autouse=True): async def clear_some_db_table(): ... ``` I'm sure this is a side-effect of the trio-fixture workaround approach [explained in the...
I'm pretty sure it's possible if we're willing to use greenlet. Here's a sketch that's missing important details like exception propagation. Hook pytest_runtest_loop to keep a Trio event loop running...
Even though I'm well aware of the `nursery` fixture's behavior of cancelling the nursery when the test function reaches end of scope, too many times I've written invalid tests that...
A pattern I've been using is handing a class instance a nursery when it is constructed, so that it can then run background tasks. Things that are working well: *...
Following from https://github.com/python-trio/cookiecutter-trio/pull/22.
Address the point made in [this comment](https://github.com/python-trio/pytest-trio/pull/76#issuecomment-453616594) by @njsmith (PR #76): > The full options there are good for CI where you can't easily re-run tests, but not what I...
I'm running the tests as [I described here](https://github.com/python-trio/pytest-trio/issues/84#issuecomment-633430425) (`PYTHONPATH="." pytest --pyargs pytest_trio`), but it seems it doesn't recognize the marker correctly: ``` ====================================================== ERRORS ======================================================= _____________________________ ERROR collecting pytest_trio/_tests/test_clock_fixture.py _____________________________...
Thank you for pytest-trio! It looks like exactly what I'm looking for - in particular async fixtures. Unfortunately I haven't been able to get it to work at all in...
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...