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

Source Code for Module EDTestCaseEDUtilsPlatform

  1  #    coding: utf8 
  2  # 
  3  #    Project: The EDNA Kernel 
  4  #             http://www.edna-site.org 
  5  # 
  6  #    File: "$Id: EDTestCaseParallelExecute.py 2128 2010-10-04 16:39:42Z kieffer $" 
  7  # 
  8  #    Copyright (C) 2008-2010 European Synchrotron Radiation Facility 
  9  #                            Grenoble, France 
 10  # 
 11  #    Principal authors: Jérôme Kieffer (kieffer@esrf.fr) 
 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  import os, sys, math, distutils.util 
 35  from EDVerbose                           import EDVerbose 
 36  from EDTestCase                          import EDTestCase 
 37  from EDAssert                            import EDAssert 
 38  from EDUtilsPlatform                     import EDUtilsPlatform 
 39   
 40   
 41   
42 -class EDTestCaseEDUtilsPlatform(EDTestCase):
43 """ 44 Unit & execution test for the EDUtilsPlatform static class 45 """ 46
47 - def __init__(self, _strTestName=None):
48 EDTestCase.__init__(self, "EDUtilsPlatform")
49 50
51 - def unitTestName(self):
52 """ 53 Test os.name 54 """ 55 EDVerbose.DEBUG("EDTestCaseEDUtilsPlatform.unitTestName") 56 if os.name != "java": 57 EDAssert.equal(os.name, EDUtilsPlatform.name, "os.name equivalent") 58 else: 59 EDAssert.equal(True, EDUtilsPlatform.name in ["posix", "nt"], "os.name equivalent")
60 61
62 - def unitTestLineSep(self):
63 """ 64 Test os.linesep 65 """ 66 EDVerbose.DEBUG("EDTestCaseEDUtilsPlatform.unitTestLineSep") 67 EDAssert.equal(os.linesep, EDUtilsPlatform.linesep, "os.linesep equivalent")
68 69
70 - def unitTestSep(self):
71 """ 72 Test os.sep 73 """ 74 EDVerbose.DEBUG("EDTestCaseEDUtilsPlatform.unitTestSep") 75 EDAssert.equal(os.sep, EDUtilsPlatform.sep, "os.sep equivalent")
76 77
78 - def unitTestArchSize(self):
79 """ 80 Test architecture and size 81 """ 82 EDVerbose.DEBUG("EDTestCaseEDUtilsPlatform.unitTestArchSize") 83 if EDUtilsPlatform.size == 64: 84 EDAssert.equal(distutils.util.get_platform(), EDUtilsPlatform.getPythonPlatform(), "distutil.util.get_platform") 85 else: 86 EDAssert.equal(distutils.util.get_platform(), EDUtilsPlatform.getSystemPlatform(), "distutil.util.get_platform")
87 88
89 - def unitTestEscapedLineSep(self):
90 """ 91 Test architecture and size 92 """ 93 EDVerbose.DEBUG("EDTestCaseEDUtilsPlatform.unitTestEscapedLineSep") 94 if EDUtilsPlatform.name == "posix": 95 EDAssert.equal("\\n", EDUtilsPlatform.escapedLinesep, "escapedLineSep") 96 else: 97 EDAssert.equal("\\r\\n", EDUtilsPlatform.escapedLinesep, "escapedLineSep")
98 99
100 - def process(self):
106 107 if __name__ == '__main__': 108 109 edTestCaseEDUtils = EDTestCaseEDUtilsUnit("EDTestCaseEDUtilsUnit") 110 edTestCaseEDUtils.execute() 111