This reverts commit 9c41c39913.
That commit used byte strings for the `if __name__ == '__main__'` pattern,
which was necessary when we were doing unicode_literals. But it is wrong on
Python 3, and now that we're liberated from unicode_literals, we need to go
back to native strings for this comparison.
Set the verbosity in the config from the beginning.
Use self-made barriers (DummyPlugin.step1, DummyPlugin.step2) and
Thread.join() to ensure everything is going as expected.
In ConcurrentEventsTest.test_concurrent_events listener1 sometimes has a
wrong log level. However the AssertionError is raised in a thread and
not the main one, so the test seems passing while it should fail.
By storing the exception and raising it later we solve that issue,
allowing to fix the random fail.
'verbose' is now an int and not a boolean. '-v' is level 1, '-vv' level
2. In the configuration it can be set with 'verbose: 1' or 'verbose: 2'.
Improve #1244: auditing current log levels of plugins remains.
Listeners get logging level modulations, like import_stages already did.
Add extensive tests:
- explicit plugin commands are logged like core beets (INFO or DEBUG)
- import stages are more silent
- event listeners are like import stages
Delete @BeetsPlugin.listen decorator since listeners need plugin instance
context to set its logging level.
Improve #1244. Next is multiple verbosity levels.
Include import of __future__ features division, absolute_imports and
print_function everywhere. Don't add unicode_literals yet for it is
harder to convert.
Goal is smoothing the transition to python 3.