Mic92 / python-mpd2

Python library which provides a client interface for the Music Player Daemon.
GNU Lesser General Public License v3.0
352 stars 119 forks source link

Asyncio handle idle errors #167

Closed chrysn closed 3 years ago

chrysn commented 3 years ago

Closes https://github.com/Mic92/python-mpd2/issues/165 by turning any error during idle into idle events (after all, something did possibly change around, for example, the database, but the application may not be able to read the status now).

Along with tests to go with it, and some test cleanup as the idle test runs long enough that mockers start being GC'd while their clients are still around enough to send idle commands. (They always did, but the tests ran though fast enough to not cause the warnings that'd now show).

chrysn commented 3 years ago

Fixed to now also work on pypy which (due to its different GC) has multiple idle consumers around at some point which is not bad but led to duplication that upset the test suite and is now deduplicated.

(pypy still does show a few warnings that the latest commit to clean things up does not catch -- it's typical of del hooking not to do what you expect on pypy and to force you to do it right, but given the warnings don't cause harm but confuse developers who typically don't have pypy as part of their development tests, I think it's fine. Alternative is to rewrite all the async tests to use proper fixtures rather than init_client.)

Mic92 commented 3 years ago

Thanks! Sorry I missed this one.