-
-
Notifications
You must be signed in to change notification settings - Fork 690
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to unit-test infinite loops? #955
Comments
Nothing wrong with my system, nothing wrong with pytest! I tried to pytest a branch that introduced an infinite loop in |
Counting the dots finally disclosed Of course a hanging layout-loop cannot be reported by assert statements (though there are 5 asserts to check the correct line breaks), but isn't there a pytest mark or decorator to stop (and report) a test that exceeds a certain time or memory limit? |
You could use unittest.mock.patch with side effect emulate a certain amount of return values and check that you never run out, but that will probably involve a lot of refactor. An easier solution and exactly what you're looking for is https://pypi.org/project/pytest-timeout/ |
Yes, pytest-timeout seems to be the only way to do that -- but I'm not convinced that the effort of implementing it in the test suite is worth the improvement. |
Lately I started
setup.py test
. It was the first time since about half a year. I know it's a lengthy task, it's tea-time, Sir. But this time I could bake a cake while the unit tests run and ate almost all memory.Eventually, after more than half an hour I killed the process. Was tired to stare at
Yeah, I guess the beloved
test_breaking_linebox_regression_*
s are expensive, expensive, expensive.But the latest successful Win build on travis only took 4 min 19 sec!
What's wrong with my system? It's 64bit Windows 7 (rebooted), Python 3.6 and Python 3.7, site-packages up-to-date.
Any advice? Other than not running unit tests at all?
The text was updated successfully, but these errors were encountered: