Closed newbrain closed 3 years ago
Thanks! I'll try to get a fix in soon. Actually, I've been wanted to rewrite the test to mock sleep()
so it doesn't actually sleep.
Fyi, this was addressed in 3dd9dc5 via #1104 (just by changing the count). If you get a chance, could you re-test and see if you still have the failure on your system?
Success!
test\unit\test_timeout.py .... [100%]
===================================================== warnings summary ======================================================
venv\lib\site-packages\pyreadline\py3k_compat.py:8
C:\Users\feder\Git\pyOCD\venv\lib\site-packages\pyreadline\py3k_compat.py:8: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
return isinstance(x, collections.Callable)
-- Docs: https://docs.pytest.org/en/stable/warnings.html
----------- coverage: platform win32, python 3.9.1-final-0 -----------
Coverage HTML written to dir htmlcov
============================================== 859 passed, 1 warning in 20.73s ==============================================
(venv) ~\Git\pyOCD [(v0.30.0)]>
OTOH, I found a problem with my code when giving an explicit uid on the command line and a picoprobe is not connected I'll write an issue, and a PR to correct it. I apologize, I was quite sure I had tested that specific case. 😔
Cool, thanks for testing.
picoprobe uid issue: Yeah, I got a report of that today from the Mbed Studio team, too, as they are testing to update to v0.30. I might get to it before you. And no worries, I've done equivalent and worse! 😄
On Windows, the monotonic clock used for sleep() by Python platform has about 15 ms resolution, as described in PEP564.
The test below is bound to fail as each iteration will consume at least 15 ms in sleep(0.01), for a total of at least 60 ms. The test can pass if a reasonably higher than 50 ms timeout is used.
https://github.com/pyocd/pyOCD/blob/b0ab779c3e347a29adf1f5e9f8b2d676c3c9cf05/test/unit/test_timeout.py#L23-L33
As demonstrated by the following simple script, a possible value should probably not be much lower than 100 ms.