Changeset 2333


Ignore:
Timestamp:
Feb 15, 2010 3:06:02 PM (10 years ago)
Author:
wehart
Message:

Misc rework of tests when glpsol is available but not pico_convert.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.plugins/releases/2.2/coopr/plugins/tests/mip/test_glpk.py

    r1939 r2333  
    3232    glpk_available=False
    3333    pass
     34
     35try:
     36    pico_convert =  pyutilib.services.registered_executable("pico_convert")
     37    pico_convert_available= (not pico_convert is None)
     38except pyutilib.common.ApplicationError:
     39    pico_convert_available=False
     40
    3441
    3542
     
    9097    def test_solve4(self):
    9198        """ Test GLPK - test4.nl """
    92         results = self.glpk.solve(currdir+"test4.nl", rformat=ResultsFormat.soln, logfile=currdir+"test_solve4.log", solnfile=currdir+"test4.soln")
    93         results.write(filename=currdir+"test_solve4.txt", times=False)
    94         self.failUnlessFileEqualsBaseline(currdir+"test_solve4.txt", currdir+"test4_glpk.txt")
    95         os.remove(currdir+"test_solve4.log")
    96         #if os.path.exists(currdir+"ipconvert.lp"):
    97            #os.remove(currdir+"ipconvert.lp")
    98         os.remove(currdir+"test4.soln")
     99        if pico_convert_available:
     100            results = self.glpk.solve(currdir+"test4.nl", rformat=ResultsFormat.soln, logfile=currdir+"test_solve4.  log")
     101            results.write(filename=currdir+"test_solve4.txt",times=False)
     102            self.failUnlessFileEqualsBaseline(currdir+"test_solve4.txt", currdir+"test4_glpk.txt")
     103            os.remove(currdir+"test4.soln")
     104            os.remove(currdir+"test_solve4.log")
     105        else:
     106            try:
     107                results = self.glpk.solve(currdir+"test4.nl", rformat=ResultsFormat.soln, logfile=currdir+"test_solve4.log")
     108            except coopr.opt.ConverterError:
     109                pass
     110
    99111       
    100112    def Xtest_solve5(self):
Note: See TracChangeset for help on using the changeset viewer.