Ejemplo n.º 1
0
def test_slack_instance_should_update_with_task_returning_true(slack, mocker):
    mocker.patch('qcodes.utils.slack.active_loop', return_value=not None)

    slack.add_task('finished', channel='CH234')
    slack.update()
    task_added = slack.tasks[-1]

    assert 'Slack.check_msmt_finished' in str(task_added.func)
Ejemplo n.º 2
0
def test_slack_instance_should_update_with_exception(slack, mocker):
    method_name = 'qcodes.utils.slack.Slack.get_new_im_messages'
    mock_get_new_im_messages = mocker.patch(method_name)
    mocker.patch('warnings.warn')
    mocker.patch('logging.info')

    for exception in [ReadTimeout, HTTPError, ConnectTimeout,
                      ReadTimeoutError('pool', 'url', 'message')]:
        mock_get_new_im_messages.side_effect = exception
        slack.update()
        assert slack.tasks == []
Ejemplo n.º 3
0
def test_slack_instance_should_update_with_task_returning_false(slack):
    slack.add_task('finished', channel='CH234')
    slack.update()
    assert slack.tasks == []
Ejemplo n.º 4
0
def test_slack_instance_should_update(slack):
    slack.update()
    assert slack.tasks == []