~tomasgroth/openlp/portable-path

« back to all changes in this revision

Viewing changes to tests/functional/openlp_core/test_threading.py

  • Committer: Tomas Groth
  • Date: 2019-04-30 19:02:42 UTC
  • mfrom: (2829.2.32 openlp)
  • Revision ID: tomasgroth@yahoo.dk-20190430190242-6zwjk8724tyux70m
trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
###############################################################################
5
5
# OpenLP - Open Source Lyrics Projection                                      #
6
6
# --------------------------------------------------------------------------- #
7
 
# Copyright (c) 2008-2018 OpenLP Developers                                   #
 
7
# Copyright (c) 2008-2019 OpenLP Developers                                   #
8
8
# --------------------------------------------------------------------------- #
9
9
# This program is free software; you can redistribute it and/or modify it     #
10
10
# under the terms of the GNU General Public License as published by the Free  #
25
25
from inspect import isfunction
26
26
from unittest.mock import MagicMock, call, patch
27
27
 
28
 
from openlp.core.threading import ThreadWorker, run_thread, get_thread_worker, is_thread_finished, make_remove_thread
 
28
from openlp.core.threading import ThreadWorker, get_thread_worker, is_thread_finished, make_remove_thread, run_thread
29
29
 
30
30
 
31
31
def test_run_thread_no_name():
133
133
    # GIVEN: A mocked thread worker
134
134
    MockRegistry.return_value.get.return_value.worker_threads = {}
135
135
 
136
 
    try:
137
 
        # WHEN: get_thread_worker() is called
138
 
        get_thread_worker('test_thread')
139
 
        assert False, 'A KeyError should have been raised'
140
 
    except KeyError:
141
 
        # THEN: The mocked worker is returned
142
 
        pass
143
 
    except Exception:
144
 
        assert False, 'A KeyError should have been raised'
 
136
    # WHEN: get_thread_worker() is called
 
137
    result = get_thread_worker('test_thread')
 
138
 
 
139
    # THEN: None should have been returned
 
140
    assert result is None
145
141
 
146
142
 
147
143
@patch('openlp.core.threading.Registry')