mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Auto merge of #396 - pimutils:fix-empty-sync, r=untitaker
Fix hangup on no-op sync None
This commit is contained in:
commit
15de73d8fc
2 changed files with 18 additions and 0 deletions
|
|
@ -408,3 +408,12 @@ def test_unknown_storage(tmpdir, runner, existing, missing):
|
||||||
"These are the configured storages: ['{existing}']"
|
"These are the configured storages: ['{existing}']"
|
||||||
.format(missing=missing, existing=existing)
|
.format(missing=missing, existing=existing)
|
||||||
) in result.output
|
) in result.output
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('cmd', ['sync', 'metasync'])
|
||||||
|
def test_no_configured_pairs(tmpdir, runner, cmd):
|
||||||
|
runner.write_with_general('')
|
||||||
|
|
||||||
|
result = runner.invoke([cmd])
|
||||||
|
assert result.output == 'critical: Nothing to do.\n'
|
||||||
|
assert result.exception.code == 5
|
||||||
|
|
@ -459,8 +459,17 @@ class WorkerQueue(object):
|
||||||
assert self._workers or not self._queue.unfinished_tasks
|
assert self._workers or not self._queue.unfinished_tasks
|
||||||
ui_worker = click_threading.UiWorker()
|
ui_worker = click_threading.UiWorker()
|
||||||
self._shutdown_handlers.append(ui_worker.shutdown)
|
self._shutdown_handlers.append(ui_worker.shutdown)
|
||||||
|
_echo = click.echo
|
||||||
|
|
||||||
with ui_worker.patch_click():
|
with ui_worker.patch_click():
|
||||||
yield
|
yield
|
||||||
|
|
||||||
|
if not self._workers:
|
||||||
|
# Ugly hack, needed because ui_worker is not running.
|
||||||
|
click.echo = _echo
|
||||||
|
cli_logger.critical('Nothing to do.')
|
||||||
|
sys.exit(5)
|
||||||
|
|
||||||
ui_worker.run()
|
ui_worker.run()
|
||||||
self._queue.join()
|
self._queue.join()
|
||||||
for worker in self._workers:
|
for worker in self._workers:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue