Commit graph

26 commits

Author SHA1 Message Date
Johnny Robeson
36ed75cd01 use reraise from six 2016-06-24 05:53:55 -04:00
Johnny Robeson
5f4678e3e8 use StringIO from six 2016-06-23 04:40:18 -04:00
Adrian Sampson
71b9fd785c Revert "Do __name__ comparison with bytes and not unicode"
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.
2016-05-29 19:19:59 -07:00
Adrian Sampson
e54c7eec3d Standardize __future__ imports without parentheses
Since the list is short enough now, we don't need parentheses for the line
wrap. This is a little less ugly.
2016-02-28 15:03:51 -08:00
Peter Kessen
955eae46c6 Removed unicode_literals from test_logging 2016-02-23 18:27:30 +01:00
Jesse Weinstein
72ce9ea3eb use underscore in name for pep-8s sake 2016-01-12 22:14:12 -08:00
Jesse Weinstein
d93f723263 Convert SKIP_SLOW_TESTS to its own decorator 2016-01-12 21:53:52 -08:00
Jesse Weinstein
760298b8e4 Mark slow tests to be skipped if SKIP_SLOW_TESTS env var is defined
Saves over 100 seconds.
2016-01-10 23:18:47 -08:00
Peter Kessen
6b408507f6 added encoding as comment in files
added line like
# -*- coding: utf-8 -*-
to all files without license
2015-11-19 18:52:57 +01:00
Peter Kessen
60e225deae corrected test for logging see #1627 2015-09-30 20:02:32 +02:00
Peter Kessen
9c34bde456 added test for logging 2015-09-27 20:16:39 +02:00
Bruno Cauet
76be623031 Fix concurrent logging testing
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.
2015-04-01 17:38:49 +02:00
Bruno Cauet
2c37602d66 Concurrent logging tests: raise thread exc in main thread
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.
2015-04-01 17:06:42 +02:00
Bruno Cauet
05de43a942 Share logging level between beets base logger refs
Add BeetsLogger.set_global_level() so the 'beets' logger has the same
level in all threads, which is important for an import session.
2015-03-31 18:03:11 +02:00
Bruno Cauet
199844671e Add concurrent logging tests
Should work for PR #1366 as well.
2015-03-25 12:57:26 +01:00
Bruno Cauet
dfa18b1119 Make beets loggers level thread local.
This updates the beets logger class. Tests are missing.
2015-03-25 12:55:40 +01:00
Bruno Cauet
998d04d3eb Update logging tests (taken from sampsyo/thread-safe-logging) 2015-03-25 12:55:37 +01:00
Bruno Cauet
f1e13cf886 Offer verbose and very verbose modes
'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.
2015-02-10 17:13:15 +01:00
Bruno Cauet
4578c4f0e1 Improve logging management for plugins
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.
2015-02-10 15:30:15 +01:00
Bruno Cauet
9c41c39913 Do __name__ comparison with bytes and not unicode 2015-01-20 12:03:57 +01:00
Bruno Cauet
2dab8e5fd6 Import unicode_literals in beets package 2015-01-19 21:41:33 +01:00
Bruno Cauet
90b388b775 Use __future__ imports but unicode_literals everywhere
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.
2015-01-19 12:25:16 +01:00
Bruno Cauet
2902cda036 tests: use absolute imports everywhere 2015-01-19 12:25:15 +01:00
Bruno Cauet
06f0e1dee1 Port beets.logging to python 2.6
Multiple hacks :-)
2015-01-05 09:21:11 +01:00
Bruno Cauet
52243269fc Make test/test_logging work on python 2.6 2015-01-04 17:14:34 +01:00
Bruno Cauet
408afa1b58 Add tests for beets.logging 2015-01-04 17:02:28 +01:00