Changeset 434


Ignore:
Timestamp:
23/10/15 09:28:20 (4 years ago)
Author:
mjuckes
Message:

additional python 3 issues

Location:
CMIP6dreqbuild/trunk/src/framework/dreqPy
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/dreqCmdl.py

    r433 r434  
    2020  elif sys.argv[1] == '--unitTest': 
    2121      print( "Starting test suite 1" ) 
    22       import unitTestsS1 
     22      import simpleCheck 
    2323      print( "Starting test suite 2" ) 
    24       import unitTestsS2 
     24      import example 
    2525      print( "Tests completed" ) 
    2626  else: 
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/scope.py

    r433 r434  
    402402  """Data Request Command line. 
    403403------------------------- 
     404      -v : print version and exit; 
     405      --unitTest : run some simple tests; 
    404406      -m <mip>:  MIP of list of MIPs (comma separated); 
    405407      -h :       help: print help text; 
  • CMIP6dreqbuild/trunk/src/framework/dreqPy/simpleCheck.py

    r429 r434  
    88except: 
    99  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' ) 
    1111  ll = [] 
    1212 
    13 requiredModules = ['xml','string','collections','os'] 
     13requiredModules = ['xml'] 
    1414confirmed = [] 
    1515installFailed = [] 
     
    1818  if x in ll or pkgutilFailed: 
    1919      try: 
    20         cmd = 'import %s' % x 
    21         exec cmd 
     20        __import__(x) 
    2221        confirmed.append( x ) 
    2322      except: 
    2423        installFailed.append( x ) 
    25         print 'Failed to install %s' % x 
     24        print ( 'Failed to install %s' % x ) 
    2625  else: 
    2726      missingLib.append( x ) 
    2827 
    2928if 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' ) 
    3130  if len(missingLib) > 0: 
    32     print 'MISSING LIBRARIES:',str(missingLib) 
     31    print ( 'MISSING LIBRARIES: %s' % str(missingLib) ) 
    3332  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) ) 
    3534  all = False 
    3635  exit(0) 
    3736else: 
    38   print 'Required libraries present' 
     37  print ( 'Required libraries present' ) 
    3938  all = True 
    4039 
     
    6362          ok &= self.ok 
    6463        except: 
    65           print 'Failed to complete check %s' % tag 
     64          print ( 'Failed to complete check %s' % tag ) 
    6665    if ok: 
    67       print '%s: All checks passed' % lab 
     66      print ( '%s: All checks passed' % lab ) 
    6867    else:  
    69       print '%s: Errors detected' % lab 
     68      print ( '%s: Errors detected' % lab ) 
    7069        
    7170class check1(checkbase): 
    7271  def _ch01_importDreq(self): 
    7372    import dreq 
    74     print 'Dreq software import checked' 
     73    print ( 'Dreq software import checked' ) 
    7574    self.ok = True 
    7675 
     
    7877    import dreq 
    7978    rq = dreq.loadDreq( dreqXML=self.sampleXml,configdoc=self.defnXml ) 
    80     print 'Dreq sample load checked' 
     79    print ( 'Dreq sample load checked' ) 
    8180    self.ok = True 
    8281 
     
    9291    ii = open( '.simpleCheck_check2_err.txt' ).readlines() 
    9392    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' ) 
    9695      self.ok = False 
    9796      self._clear_ch03() 
     
    9998    ii = open( '.simpleCheck_check2.txt' ).readlines() 
    10099    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' ) 
    103102      self.ok = False 
    104103      self._clear_ch03() 
     
    109108    ii = open( '.simpleCheck_check2_err.txt' ).readlines() 
    110109    if len(ii) == 0: 
    111       print 'WARNING[003]: Failed to capture xmllint response' 
    112       print cmd 
     110      print ( 'WARNING[003]: Failed to capture xmllint response' ) 
     111      print ( cmd ) 
    113112      self.ok = False 
    114113      self._clear_ch03() 
    115114      return 
    116115    if string.find(ii[0],'validates') != -1: 
    117       print 'Sample XML validated' 
     116      print ( 'Sample XML validated' ) 
    118117      self.ok = True 
    119118      self._clear_ch03() 
    120119    else: 
    121       print 'Sample XML failed to validate' 
    122       print cmd 
     120      print ( 'Sample XML failed to validate' ) 
     121      print ( cmd ) 
    123122      self.ok = False 
    124123    return 
     
    128127 
    129128if all: 
    130   print 'ALL CHECK PASSED' 
     129  print ( 'ALL CHECK PASSED' ) 
Note: See TracChangeset for help on using the changeset viewer.