Use daemon threads to test infinite while loops in Python
Redowan Delowar
November 18, 2021
Python's daemon threads are cool. A Python script will stop when the main thread is done and
only daemon threads are running. To test a simple hello function that runs indefinitely,
you can do the following:
To execute the script, make sure you've your virtual env actiavated. Also you'll need to
install pytest and pytest-asyncio. Then run:
The idea came from this [Quora answer].
[quora answer]:
https://qr.ae/pGDHVw
Discussion in the ATmosphere