summaryrefslogtreecommitdiff
path: root/gear/tests/test_functional.py
diff options
context:
space:
mode:
Diffstat (limited to 'gear/tests/test_functional.py')
-rw-r--r--gear/tests/test_functional.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/gear/tests/test_functional.py b/gear/tests/test_functional.py
index 247649a..26e72e3 100644
--- a/gear/tests/test_functional.py
+++ b/gear/tests/test_functional.py
@@ -14,11 +14,13 @@
# limitations under the License.
import os
+import threading
import time
from OpenSSL import crypto
import fixtures
import testscenarios
+import testtools
import gear
from gear import tests
@@ -125,6 +127,16 @@ class TestFunctional(tests.BaseTestCase):
self.assertTrue(job.complete)
self.assertEqual(job.data, [b'workdata'])
+ def test_worker_termination(self):
+ def getJob():
+ with testtools.ExpectedException(gear.InterruptedError):
+ self.worker.getJob()
+ self.worker.registerFunction('test')
+ jobthread = threading.Thread(target=getJob)
+ jobthread.daemon = True
+ jobthread.start()
+ self.worker.stopWaitingForJobs()
+
def load_tests(loader, in_tests, pattern):
return testscenarios.load_tests_apply_scenarios(loader, in_tests, pattern)