Enable debug logging for test_move_tree magic-folder unit test

This commit is contained in:
David Stainton 2016-10-19 14:13:18 +00:00 committed by Brian Warner
parent 6071c2b6f8
commit d6cbe44786
2 changed files with 14 additions and 1 deletions

View File

@ -86,6 +86,11 @@ class MagicFolder(service.MultiService):
self.set_public_status)
self._public_status = (False, ['Magic folder has not yet started'])
def enable_debug_log(self):
print "enable debug log"
self.uploader.enable_debug_log()
self.downloader.enable_debug_log()
def get_public_status(self):
"""
For the web UI, basically.
@ -135,6 +140,8 @@ class QueueMixin(HookMixin):
self._db = db
self._name = name
self._clock = clock
self._debug_log = False
self._logger = None
self._hooks = {
'processed': None,
'started': None,
@ -165,6 +172,10 @@ class QueueMixin(HookMixin):
# far)
self._processing = defer.succeed(None)
def enable_debug_log(self):
print "queue mixin enable debug logging"
self._debug_log = True
def get_status(self):
"""
Returns an iterable of instances that implement IQueuedItem
@ -274,7 +285,8 @@ class QueueMixin(HookMixin):
def _log(self, msg):
s = "Magic Folder %s %s: %s" % (quote_output(self._client.nickname), self._name, msg)
self._client.log(s)
if self._debug_log:
twlog.msg(s)
# this isn't in interfaces.py because it's very specific to QueueMixin
class IQueuedItem(Interface):

View File

@ -1137,6 +1137,7 @@ class SingleMagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, Reall
into the magic folder, so we upload the file and record the
directory. (XXX split to separate test)
"""
self.magicfolder.enable_debug_log()
empty_tree_name = self.unicode_or_fallback(u"empty_tr\u00EAe", u"empty_tree")
empty_tree_dir = abspath_expanduser_unicode(empty_tree_name, base=self.basedir)
new_empty_tree_dir = abspath_expanduser_unicode(empty_tree_name, base=self.local_dir)