Changeset 434 for CMIP6dreqbuild/trunk/src
- Timestamp:
- 23/10/15 09:28:20 (7 years ago)
- Location:
- CMIP6dreqbuild/trunk/src/framework/dreqPy
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
CMIP6dreqbuild/trunk/src/framework/dreqPy/dreqCmdl.py
r433 r434 20 20 elif sys.argv[1] == '--unitTest': 21 21 print( "Starting test suite 1" ) 22 import unitTestsS122 import simpleCheck 23 23 print( "Starting test suite 2" ) 24 import unitTestsS224 import example 25 25 print( "Tests completed" ) 26 26 else: -
CMIP6dreqbuild/trunk/src/framework/dreqPy/scope.py
r433 r434 402 402 """Data Request Command line. 403 403 ------------------------- 404 -v : print version and exit; 405 --unitTest : run some simple tests; 404 406 -m <mip>: MIP of list of MIPs (comma separated); 405 407 -h : help: print help text; -
CMIP6dreqbuild/trunk/src/framework/dreqPy/simpleCheck.py
r429 r434 8 8 except: 9 9 pkgutilFailed=True 10 print 'Failed to load pkgutil .. more limited tests on available modules will be done'10 print ( 'Failed to load pkgutil .. more limited tests on available modules will be done' ) 11 11 ll = [] 12 12 13 requiredModules = ['xml' ,'string','collections','os']13 requiredModules = ['xml'] 14 14 confirmed = [] 15 15 installFailed = [] … … 18 18 if x in ll or pkgutilFailed: 19 19 try: 20 cmd = 'import %s' % x 21 exec cmd 20 __import__(x) 22 21 confirmed.append( x ) 23 22 except: 24 23 installFailed.append( x ) 25 print 'Failed to install %s' % x24 print ( 'Failed to install %s' % x ) 26 25 else: 27 26 missingLib.append( x ) 28 27 29 28 if len( missingLib ) > 0 or len(installFailed) > 0: 30 print 'Could not load all required python libraries'29 print ( 'Could not load all required python libraries' ) 31 30 if len(missingLib) > 0: 32 print 'MISSING LIBRARIES:',str(missingLib)31 print ( 'MISSING LIBRARIES: %s' % str(missingLib) ) 33 32 if len(installFailed) > 0: 34 print 'LIBRARIES PRESENT BUT FAILED TO INSTALL:',str(missingLib)33 print ( 'LIBRARIES PRESENT BUT FAILED TO INSTALL:%s' % str(missingLib) ) 35 34 all = False 36 35 exit(0) 37 36 else: 38 print 'Required libraries present'37 print ( 'Required libraries present' ) 39 38 all = True 40 39 … … 63 62 ok &= self.ok 64 63 except: 65 print 'Failed to complete check %s' % tag64 print ( 'Failed to complete check %s' % tag ) 66 65 if ok: 67 print '%s: All checks passed' % lab66 print ( '%s: All checks passed' % lab ) 68 67 else: 69 print '%s: Errors detected' % lab68 print ( '%s: Errors detected' % lab ) 70 69 71 70 class check1(checkbase): 72 71 def _ch01_importDreq(self): 73 72 import dreq 74 print 'Dreq software import checked'73 print ( 'Dreq software import checked' ) 75 74 self.ok = True 76 75 … … 78 77 import dreq 79 78 rq = dreq.loadDreq( dreqXML=self.sampleXml,configdoc=self.defnXml ) 80 print 'Dreq sample load checked'79 print ( 'Dreq sample load checked' ) 81 80 self.ok = True 82 81 … … 92 91 ii = open( '.simpleCheck_check2_err.txt' ).readlines() 93 92 if len(ii) > 0: 94 print 'WARNING[001]: failed to detect xmllint command line program'95 print 'optional checks omitted'93 print ( 'WARNING[001]: failed to detect xmllint command line program' ) 94 print ( 'optional checks omitted' ) 96 95 self.ok = False 97 96 self._clear_ch03() … … 99 98 ii = open( '.simpleCheck_check2.txt' ).readlines() 100 99 if len(ii) < 1: 101 print 'WARNING[002]: failed to detect xmllint command line program'102 print 'optional checks omitted'100 print ( 'WARNING[002]: failed to detect xmllint command line program' ) 101 print ( 'Optional checks omitted' ) 103 102 self.ok = False 104 103 self._clear_ch03() … … 109 108 ii = open( '.simpleCheck_check2_err.txt' ).readlines() 110 109 if len(ii) == 0: 111 print 'WARNING[003]: Failed to capture xmllint response'112 print cmd110 print ( 'WARNING[003]: Failed to capture xmllint response' ) 111 print ( cmd ) 113 112 self.ok = False 114 113 self._clear_ch03() 115 114 return 116 115 if string.find(ii[0],'validates') != -1: 117 print 'Sample XML validated'116 print ( 'Sample XML validated' ) 118 117 self.ok = True 119 118 self._clear_ch03() 120 119 else: 121 print 'Sample XML failed to validate'122 print cmd120 print ( 'Sample XML failed to validate' ) 121 print ( cmd ) 123 122 self.ok = False 124 123 return … … 128 127 129 128 if all: 130 print 'ALL CHECK PASSED'129 print ( 'ALL CHECK PASSED' )
Note: See TracChangeset
for help on using the changeset viewer.