Conversation
|
Please read https://docs.pytest.org/en/6.2.x/writing_plugins.html#testing-plugins
The plugin has no documentation, IMHO. Here is an example of calling pytest with custom cmdline arguments: https://github.com/aio-libs/aiohttp/blob/master/tests/test_pytest_plugin.py#L140-L150 |
Codecov Report
@@ Coverage Diff @@
## master #216 +/- ##
==========================================
+ Coverage 95.43% 95.79% +0.36%
==========================================
Files 2 2
Lines 219 238 +19
==========================================
+ Hits 209 228 +19
Misses 10 10
Continue to review full report at Codecov.
|
|
Didn't know about |
|
The PR is not complete until timeout disabling on debugging is implemented, as in pytest-timeout. |
…down_timeout methods (#117) It seems pytest-asyncio is interested in this. See e.g. pytest-dev/pytest-asyncio#216
|
I'm interested in timeouts for my asyncio tests and it looks like this might be the path to that. Is that correct? What is needed here? |
|
Any chance that this PR could make progress? This seems like a really important fundamental tool for testing |
|
This PR introduces a "runner" abstraction and adds the timeout functionality. This is also the general way forward for pytest-asyncio. Preferably, these two things should happen in separate PRs, one that introduces the Runner and another one that adds timeout functionality. PR #312 is draft that does both. Moreover, it adds a dependency on aioloop-proxy which is completely separate from this feature. Since it's unclear who will be able to maintain aioloop-proxy, please try to keep the loop proxy topic separate from #312 if you decide to rebase the draft. Does that answer your questions? |
|
I will actually go ahead and close this PR. The code here drifted significantly from my much simpler initial contribution attempt and I do not intend to pick this up again. If somebody wants to finish this up, please open a new PR. |
pytest-dev/pytest-asyncio#216 (comment) > The PR is not complete until timeout disabling on debugging is > implemented, as in pytest-timeout. > Otherwise, any tests debug session ends with TimeoutError quickly. > I'm not sure is it worth to copy-paste the whole implementation > from pytest-timeout plugin? > Maybe adding timeout_setup()/timeout_teardown() hooks for > implementing them in pytest-asyncio makes the code easier and stablier? > Should take time for experimenting. > - asvetlov
This adds the option to add timeouts to tests either via marker kwargs or via options/CLI arguments.
The naming of the options is intentionally prefixes with asyncio to avoid clashes with
pytest-timeout. Marker kwargs do not have this ambiguity and I therefore allowed both.I don't have a good sense on how to test the options via config and CLI. If somebody got an idea, I'd be happy to implement it.
Closes #215
Depends on pytest-dev/pytest-timeout#117