add 'size' to tests, print unicode

This commit is contained in:
meejah 2018-01-16 20:44:57 -07:00
parent 0ebb587666
commit bfabfeba64
2 changed files with 12 additions and 3 deletions

View File

@ -619,7 +619,7 @@ class Uploader(QueueMixin):
fp = self._get_filepath(relpath_u)
pathinfo = get_pathinfo(unicode_from_filepath(fp))
progress = PercentProgress()
self._log("add pending size: {}: {}".format(relpath_u, pathinfo.size))
self._log(u"add pending size: {}: {}".format(relpath_u, pathinfo.size))
item = UploadItem(relpath_u, progress, pathinfo.size)
item.set_status('queued', self._clock.seconds())
self._deque.append(item)
@ -655,7 +655,8 @@ class Uploader(QueueMixin):
try:
return self._real_notify(opaque, path, events_mask)
except Exception as e:
self._log("error calling _real_notify: {}".format(e))
self._log(u"error calling _real_notify: {}".format(e))
return Failure()
def _real_notify(self, opaque, path, events_mask):
self._log("inotify event %r, %r, %r\n" % (opaque, path, ', '.join(self._inotify.humanReadableMask(events_mask))))

View File

@ -127,6 +127,7 @@ class FakeStatusItem(object):
import mock
self.progress = mock.Mock()
self.progress.progress = 100.0
self.size = 1234
def status_history(self):
return self.history
@ -1017,7 +1018,14 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
self.assertEqual(
data,
[
{"status": "done", "path": "rel/path", "kind": "upload", "percent_done": 100.0, "done_at": 12345},
{
"status": "done",
"path": "rel/path",
"kind": "upload",
"percent_done": 100.0,
"done_at": 12345,
"size": 1234,
},
]
)