Show More
@@ -1,66 +1,78 b'' | |||||
1 | # encoding: utf-8 |
|
1 | # encoding: utf-8 | |
2 |
|
2 | |||
3 | """This file contains unittests for the kernel.engineservice.py module. |
|
3 | """This file contains unittests for the kernel.engineservice.py module. | |
4 |
|
4 | |||
5 | Things that should be tested: |
|
5 | Things that should be tested: | |
6 |
|
6 | |||
7 | - Should the EngineService return Deferred objects? |
|
7 | - Should the EngineService return Deferred objects? | |
8 | - Run the same tests that are run in shell.py. |
|
8 | - Run the same tests that are run in shell.py. | |
9 | - Make sure that the Interface is really implemented. |
|
9 | - Make sure that the Interface is really implemented. | |
10 | - The startService and stopService methods. |
|
10 | - The startService and stopService methods. | |
11 | """ |
|
11 | """ | |
12 |
|
12 | |||
13 | __docformat__ = "restructuredtext en" |
|
13 | __docformat__ = "restructuredtext en" | |
14 |
|
14 | |||
15 | #------------------------------------------------------------------------------- |
|
15 | #------------------------------------------------------------------------------- | |
16 | # Copyright (C) 2008 The IPython Development Team |
|
16 | # Copyright (C) 2008 The IPython Development Team | |
17 | # |
|
17 | # | |
18 | # Distributed under the terms of the BSD License. The full license is in |
|
18 | # Distributed under the terms of the BSD License. The full license is in | |
19 | # the file COPYING, distributed as part of this software. |
|
19 | # the file COPYING, distributed as part of this software. | |
20 | #------------------------------------------------------------------------------- |
|
20 | #------------------------------------------------------------------------------- | |
21 |
|
21 | |||
22 | #------------------------------------------------------------------------------- |
|
22 | #------------------------------------------------------------------------------- | |
23 | # Imports |
|
23 | # Imports | |
24 | #------------------------------------------------------------------------------- |
|
24 | #------------------------------------------------------------------------------- | |
25 |
|
25 | |||
26 | try: |
|
26 | try: | |
27 | from twisted.internet import defer |
|
27 | from twisted.internet import defer | |
28 | from twisted.application.service import IService |
|
28 | from twisted.application.service import IService | |
29 |
|
29 | |||
30 | from IPython.kernel import engineservice as es |
|
30 | from IPython.kernel import engineservice as es | |
31 | from IPython.testing.util import DeferredTestCase |
|
31 | from IPython.testing.util import DeferredTestCase | |
32 | from IPython.kernel.tests.engineservicetest import \ |
|
32 | from IPython.kernel.tests.engineservicetest import \ | |
33 | IEngineCoreTestCase, \ |
|
33 | IEngineCoreTestCase, \ | |
34 | IEngineSerializedTestCase, \ |
|
34 | IEngineSerializedTestCase, \ | |
35 | IEngineQueuedTestCase, \ |
|
35 | IEngineQueuedTestCase, \ | |
36 | IEnginePropertiesTestCase |
|
36 | IEnginePropertiesTestCase | |
37 | except ImportError: |
|
37 | except ImportError: | |
38 | pass |
|
38 | pass | |
39 | else: |
|
39 | else: | |
40 | class BasicEngineServiceTest(DeferredTestCase, |
|
40 | class BasicEngineServiceTest(DeferredTestCase, | |
41 | IEngineCoreTestCase, |
|
41 | IEngineCoreTestCase, | |
42 | IEngineSerializedTestCase, |
|
42 | IEngineSerializedTestCase, | |
43 | IEnginePropertiesTestCase): |
|
43 | IEnginePropertiesTestCase): | |
44 |
|
44 | |||
45 | def setUp(self): |
|
45 | def setUp(self): | |
46 | self.engine = es.EngineService() |
|
46 | self.engine = es.EngineService() | |
47 | self.engine.startService() |
|
47 | self.engine.startService() | |
48 |
|
48 | |||
49 | def tearDown(self): |
|
49 | def tearDown(self): | |
50 | return self.engine.stopService() |
|
50 | return self.engine.stopService() | |
|
51 | ||||
|
52 | class ThreadedEngineServiceTest(DeferredTestCase, | |||
|
53 | IEngineCoreTestCase, | |||
|
54 | IEngineSerializedTestCase, | |||
|
55 | IEnginePropertiesTestCase): | |||
|
56 | ||||
|
57 | def setUp(self): | |||
|
58 | self.engine = es.ThreadedEngineService() | |||
|
59 | self.engine.startService() | |||
|
60 | ||||
|
61 | def tearDown(self): | |||
|
62 | return self.engine.stopService() | |||
51 |
|
63 | |||
52 | class QueuedEngineServiceTest(DeferredTestCase, |
|
64 | class QueuedEngineServiceTest(DeferredTestCase, | |
53 | IEngineCoreTestCase, |
|
65 | IEngineCoreTestCase, | |
54 | IEngineSerializedTestCase, |
|
66 | IEngineSerializedTestCase, | |
55 | IEnginePropertiesTestCase, |
|
67 | IEnginePropertiesTestCase, | |
56 | IEngineQueuedTestCase): |
|
68 | IEngineQueuedTestCase): | |
57 |
|
69 | |||
58 | def setUp(self): |
|
70 | def setUp(self): | |
59 | self.rawEngine = es.EngineService() |
|
71 | self.rawEngine = es.EngineService() | |
60 | self.rawEngine.startService() |
|
72 | self.rawEngine.startService() | |
61 | self.engine = es.IEngineQueued(self.rawEngine) |
|
73 | self.engine = es.IEngineQueued(self.rawEngine) | |
62 |
|
74 | |||
63 | def tearDown(self): |
|
75 | def tearDown(self): | |
64 | return self.rawEngine.stopService() |
|
76 | return self.rawEngine.stopService() | |
65 |
|
77 | |||
66 |
|
78 |
General Comments 0
You need to be logged in to leave comments.
Login now