samuelcolvin / python-devtools

Dev tools for python
https://python-devtools.helpmanual.io/
MIT License
974 stars 48 forks source link

test_timer can fail for no real reason under certain conditions #147

Open ri0t opened 10 months ago

ri0t commented 10 months ago

Helloes,

under certain conditions (maybe system load being high?) the timer tests can fail randomly:

error: builder for '/nix/store/r19bvjb3xkabyzl3w2s19kw16gafachy-python3.11-devtools-0.12.2.drv' failed with exit code 1; last 10 log lines:

E - 3 times: mean=0.00Xs stdev=0.00Xs min=0.00Xs max=0.00Xs E ? - E + 3 times: mean=0.00Xs stdev=0.00Xs min=0.00Xs max=0.010s E ? +

tests/test_timer.py:31: AssertionError =========================== short test summary info ============================ FAILED tests/test_timer.py::test_multiple - AssertionError: assert '0.00X: 0.010... max=0.010s\n' == '0.00X: 0.00X... m... ============ 1 failed, 95 passed, 8 skipped, 6 deselected in 0.58s =============

Notice the minor timer invariance of 0.010s. I restarted the whole build process a few times and suddenly it built without any changes.

samuelcolvin commented 10 months ago

Well probably because of unexpected low system resources causing the slower execution.

PR welcome to fix this.