Ignore:
Timestamp:
Jan 24, 2024, 12:09:57 AM (21 months ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.7.0, stable
Children:
5a479d
Parents:
6dde30
git-author:
Frederik Heber <frederik.heber@…> (01/24/24 00:09:17)
git-committer:
Frederik Heber <frederik.heber@…> (01/24/24 00:09:57)
Message:

Python3: Test/Python changed.

  • print -> print()
Location:
tests/Python/AllActions
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tests/Python/AllActions/moltest.py

    r6dde30 rd083cc  
    2727              key, value = line.split('\t', 1)
    2828            except ValueError:
    29               print "line needs two values, tab-separated: "+line
     29              print("line needs two values, tab-separated: "+line)
    3030              sys.exit(1)
    3131            value = value[1:-2] # quotes entfernen
     
    4646           
    4747            if not param in Defaults:
    48                 print 'Fehlender Defaultwert:', param
     48                print('Fehlender Defaultwert:', param)
    4949       
    5050        # direkt substituieren, oder erst beim aufruf?
     
    5959params = ParseParameters(doc)
    6060
    61 print '--BEGIN-- %s mit %s --------' % (cmd, params)
     61print('--BEGIN-- %s mit %s --------' % (cmd, params))
    6262   
    6363# write command to file
     
    6666output.close()
    6767# call python externally on this file and catch retcode
    68 p = subprocess.Popen(["python", "test.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     68p = subprocess.Popen(["python3", "test.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    6969stdout, stderr = p.communicate()
    70 print ' --- STDOUT ---'
    71 print ' %s ' % (stdout)
    72 print ' --- STDERR ---'
    73 print ' %s ' % (stderr)
     70print(' --- STDOUT ---')
     71print(' %s ' % (stdout))
     72print(' --- STDERR ---')
     73print(' %s ' % (stderr))
    7474retcode = p.returncode
    7575if retcode == 134 or retcode == 0:
    76   print ' ---- ok ----'
     76  print(' ---- ok ----')
    7777else:
    78   print ' -- FAILED with %s --' % (retcode)
     78  print(' -- FAILED with %s --' % (retcode))
    7979#  if retcode == 1:
    8080#    sys.exit(1)
    8181#exec('mol.%s(*params)' % cmd)
    8282
    83 print '---END--- %s mit %s --------' % (cmd, params)
     83print('---END--- %s mit %s --------' % (cmd, params))
    8484
    8585sys.exit(0)
  • tests/Python/AllActions/moltest_check.py

    r6dde30 rd083cc  
    1414              key, value = line.split('\t', 1)
    1515            except ValueError:
    16               print "line needs two values, tab-separated: "+line
     16              print("line needs two values, tab-separated: "+line)
    1717              sys.exit(1)
    1818            value = value[1:-2] # remove quotes
     
    3131           
    3232            if not param in Defaults:
    33                 print >> sys.stderr, param # write missing default value to stderr
     33                print(param, file=sys.stderr) # write missing default value to stderr
    3434                result = 1
    3535
     
    3939
    4040for cmd in cmds:
    41     print "Checking on %s" % cmd
     41    print("Checking on %s" % cmd)
    4242    doc = eval('mol.%s.__doc__' % cmd)
    4343    if CheckParameters(doc) == 1:
  • tests/Python/AllActions/testsuite-python-allactions.at

    r6dde30 rd083cc  
    2323AT_DATA([test.py], [
    2424import pyMoleCuilder as mol
    25 print mol.ThisCommandIsNotPresent()
     25print(mol.ThisCommandIsNotPresent())
    2626])
    2727AT_CHECK([../../run test.py], 1, [ignore], [stderr])
    28 AT_CHECK([fgrep "object has no attribute" stderr], 0, [ignore], [ignore])
     28AT_CHECK([fgrep "has no attribute" stderr], 0, [ignore], [ignore])
    2929AT_CHECK([../../run ${abs_top_srcdir}/tests/Python/AllActions/listcmds.py], 0, [stdout], [ignore])
    3030AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/Python/AllActions/options.dat .],  0, [ignore], [ignore])
Note: See TracChangeset for help on using the changeset viewer.