Module EDTestCaseEDStatus
[hide private]
[frames] | no frames]

Source Code for Module EDTestCaseEDStatus

 1  # coding: utf8 
 2  # 
 3  #    Project: The EDNA Kernel 
 4  #             http://www.edna-site.org 
 5  # 
 6  #    File: "$Id: EDTestCaseParallelExecute.py 2548 2010-12-01 09:14:01Z kieffer $" 
 7  # 
 8  #    Copyright (C) 2011-2011 European Synchrotron Radiation Facility 
 9  #                            Grenoble, France 
10  # 
11  #    Principal authors: Jérôme Kieffer (Jerome.Kieffer@esrf.eu) 
12  #                         
13  # 
14  #    This program is free software: you can redistribute it and/or modify 
15  #    it under the terms of the GNU Lesser General Public License as published 
16  #    by the Free Software Foundation, either version 3 of the License, or 
17  #    (at your option) any later version. 
18  # 
19  #    This program is distributed in the hope that it will be useful, 
20  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
21  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
22  #    GNU Lesser General Public License for more details. 
23  # 
24  #    You should have received a copy of the GNU General Public License 
25  #    and the GNU Lesser General Public License  along with this program.   
26  #    If not, see <http://www.gnu.org/licenses/>. 
27  # 
28   
29  __authors__ = ["Jérôme Kieffer"] 
30  __contact__ = "Jerome.Kieffer@esrf.eu" 
31  __license__ = "LGPLv3+" 
32  __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France" 
33   
34  """This is the EDJob interface for launching jobs""" 
35   
36  import  time 
37  from EDVerbose                           import EDVerbose 
38  from EDTestCase                          import EDTestCase 
39  from EDAssert                            import EDAssert 
40  from EDStatus                            import EDStatus 
41   
42   
43 -class EDTestCaseEDStatus(EDTestCase):
44 """ 45 Unit test for status 46 """ 47 strPluginName = "EDPluginTestPluginFailure" 48
49 - def unitTestInitialState(self):
50 """ 51 check the status after a job creation 52 """ 53 EDVerbose.DEBUG("EDTestCaseEDStatus.unitTestInitialState") 54 EDVerbose.DEBUG("Success Plugins: " + ",".join(EDStatus.getSuccess())) 55 EDVerbose.DEBUG("Running Plugins: " + ",".join(EDStatus.getRunning())) 56 EDVerbose.DEBUG("Failed Plugins: " + ",".join(EDStatus.getFailure())) 57 EDAssert.equal(False, self.strPluginName in EDStatus.getRunning(), "Plugin not yet running") 58 EDAssert.equal(False, self.strPluginName in EDStatus.getSuccess(), "Plugin not yet Finished") 59 EDAssert.equal(False, self.strPluginName in EDStatus.getFailure(), "Plugin not yet Finished")
60 61
62 - def unitTestRunning(self):
63 """ 64 check the status after a job creation 65 """ 66 EDVerbose.DEBUG("EDTestCaseEDStatus.unitTestRunning") 67 EDStatus.tellRunning(self.strPluginName) 68 EDVerbose.DEBUG("Success Plugins: " + ",".join(EDStatus.getSuccess())) 69 EDVerbose.DEBUG("Running Plugins: " + ",".join(EDStatus.getRunning())) 70 EDVerbose.DEBUG("Failed Plugins: " + ",".join(EDStatus.getFailure())) 71 EDAssert.equal(True, self.strPluginName in EDStatus.getRunning(), "Plugin running") 72 EDAssert.equal(False, self.strPluginName in EDStatus.getSuccess(), "Plugin not yet Finished") 73 EDAssert.equal(False, self.strPluginName in EDStatus.getFailure(), "Plugin not yet Finished")
74
75 - def unitTestFailed(self):
76 """ 77 check the failure of a plugin is registerd 78 """ 79 EDVerbose.DEBUG("EDTestCaseEDStatus.unitTestFailed") 80 EDStatus.tellFailure(self.strPluginName) 81 EDVerbose.DEBUG("Success Plugins: " + ",".join(EDStatus.getSuccess())) 82 EDVerbose.DEBUG("Running Plugins: " + ",".join(EDStatus.getRunning())) 83 EDVerbose.DEBUG("Failed Plugins: " + ",".join(EDStatus.getFailure())) 84 EDAssert.equal(False, self.strPluginName in EDStatus.getRunning(), "Plugin not yet running") 85 EDAssert.equal(False, self.strPluginName in EDStatus.getSuccess(), "Plugin not yet Finished") 86 EDAssert.equal(True, self.strPluginName in EDStatus.getFailure(), "Plugin Failed as expected")
87
88 - def process(self):
92 93 94 if __name__ == '__main__': 95 96 edTestCase = EDTestCaseEDStatus("EDTestCaseEDStatus") 97 edTestCase.execute() 98