delfick / alt-pytest-asyncio

An alternative plugin for pytest to make it support async tests and fixtures
https://alt-pytest-asyncio.readthedocs.io
MIT License
27 stars 5 forks source link

include a new command line option called --async-timeout #3

Closed andredias closed 4 years ago

andredias commented 4 years ago

I'd like to propose the inclusion of a new command-line option to control the timeout. It'll be useful for debugging. Also, I changed default_alt_async_timeout to async_timeout. The former is too long and specific. Considering that there won't be another pytest plugin for asynchronous tests, it could be shorter.

delfick commented 4 years ago

I'm happy to add a cli option, that's a good idea

I prefer default async timeout, because it's overridable by using an @pytest.mark.async_timeout

i.e. to give your test it's own 20 second timeout

@pytest.mark.async_timeout(20)
async def test_that_ensures_my_program_is_awesome():
   assert program.is_awesome
delfick commented 4 years ago

Awesome! Thanks.

I'll just get you to do:

python3 -m pip install venvstarter
./format

It seems ./lint doesn't find warnings in your change, but there's an existing warning and I'll fix that separately :)

delfick commented 4 years ago

Awesome, thanks :)

delfick commented 4 years ago

sigh, I pressed rebase instead of squash. Oh well.

delfick commented 4 years ago

Ok, I load the plugin dynamically because of the ability to override the event loop, so that option isn't available on the cli when you run pytest. So I had to move it, https://github.com/delfick/alt-pytest-asyncio/commit/eecb08c222caa06a101774cae9672e2ceec7e952

Was it working for you?

andredias commented 4 years ago

It wasn't.

Em seg., 24 de ago. de 2020 às 00:40, Stephen Moore < notifications@github.com> escreveu:

Ok, I load the plugin dynamically because of the ability to override the event loop, so that option isn't available on the cli when you run pytest. So I had to move it, eecb08c https://github.com/delfick/alt-pytest-asyncio/commit/eecb08c222caa06a101774cae9672e2ceec7e952

Was it working for you?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/delfick/alt-pytest-asyncio/pull/3#issuecomment-678887068, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG4LDDR53G3DI4FEPUGDZLSCHOKFANCNFSM4QAHOTOA .

delfick commented 4 years ago

I see, that would have been helpful to mention :)

andredias commented 4 years ago

I thought it was a test thing. Also, since there are no instructions about how to set up a development environment, I used poetry but it was far from ideal.

Em ter., 25 de ago. de 2020 às 01:55, Stephen Moore < notifications@github.com> escreveu:

I see, that would have been helpful to mention :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/delfick/alt-pytest-asyncio/pull/3#issuecomment-679631157, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG4LDGILSMGKE2M3CEJ6WLSCM75HANCNFSM4QAHOTOA .

delfick commented 4 years ago

fair enough.

Essentially

python3 -m venv alt-pytest-asyncio
source alt-pytest-asyncio/bin/activate
pip install -e /path/to/local_git_checkout
pip install pytest

Then you create some tests files somewhere and in that folder

source alt-pytest-asyncio/bin/activate
pytest --default-async-timeout 6

And play with that.

The -e in that first pip command means the code is referenced via a symlink and so changes there don't need to be reinstalled into the virtualenv.