Changeset 2334


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

Updating GLPK test to work when pico_convert is not available.

File:
1 edited

Legend:

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

    r2308 r2334  
    3333    pass
    3434
     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
     41
    3542
    3643class mock_all(pyutilib.th.TestCase):
     
    4552        else:
    4653            self.glpk = coopr.plugins.mip.MockGLPK(keepFiles=True)
    47         self.glpk.suffixes=['.*']
    4854
    4955    def tearDown(self):
     
    9197    def test_solve4(self):
    9298        """ Test GLPK - test4.nl """
    93         results = self.glpk.solve(currdir+"test4.nl", rformat=ResultsFormat.soln, logfile=currdir+"test_solve4.log", solnfile=currdir+"test4.soln")
    94         results.write(filename=currdir+"test_solve4.txt", times=False)
    95         self.failUnlessFileEqualsBaseline(currdir+"test_solve4.txt", currdir+"test4_glpk.txt")
    96         os.remove(currdir+"test_solve4.log")
    97         #if os.path.exists(currdir+"ipconvert.lp"):
    98            #os.remove(currdir+"ipconvert.lp")
    99         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
    100111       
    101112    def Xtest_solve5(self):
Note: See TracChangeset for help on using the changeset viewer.