Changeset 1768 for trunk/test/core


Ignore:
Timestamp:
Oct 28, 2009 8:14:26 PM (10 years ago)
Author:
wehart
Message:

Rework of Coopr to use the new PyUtilib? package decomposition.

NOTE: to use Coopr with this update, we need to work with a new version of coopr_install.

Location:
trunk/test/core
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/core/base/test_config.py

    r1657 r1768  
    1414from nose.tools import nottest
    1515import coopr.opt
    16 import pyutilib
     16import pyutilib.services
     17import pyutilib.plugin.app
     18import pyutilib.misc
    1719
    18 pyutilib.TempfileManager.tempdir = currdir
     20pyutilib.services.TempfileManager.tempdir = currdir
    1921
    2022class OptConfigDebug(unittest.TestCase):
    2123
    2224    def setUp(self):
    23         pyutilib.TempfileManager.tempdir = currdir
     25        pyutilib.services.TempfileManager.tempdir = currdir
    2426
    2527    def tearDown(self):
    26         pyutilib.TempfileManager.clear_tempfiles()
     28        pyutilib.services.TempfileManager.clear_tempfiles()
    2729
    2830    def test_config1(self):
     
    3032        Read in config file opt1.cfg
    3133        """
    32         app = pyutilib.plugin.SimpleApplication("testapp")
     34        app = pyutilib.plugin.app.SimpleApplication("testapp")
    3335        #pyutilib.plugin.PluginGlobals.pprint()
    3436        #app.config.summarize()
    3537        app.save_configuration(currdir+"opt1-out.cfg")
    3638        app.configure(currdir+"opt1.cfg")
    37         if pyutilib.registered_executable("pico_convert"):
    38             self.failUnlessEqual( pyutilib.registered_executable("pico_convert").get_path(), pyutilib.search_file("pico_convert"))
    39         if pyutilib.registered_executable("glpsol"):
    40             self.failUnlessEqual( pyutilib.registered_executable("glpsol").get_path(), pyutilib.search_file("glpsol"))
    41         if pyutilib.registered_executable("ampl"):
    42             self.failUnlessEqual( pyutilib.registered_executable("ampl").get_path(), pyutilib.search_file("ampl"))
    43         if pyutilib.registered_executable("timer"):
    44             self.failUnlessEqual( pyutilib.registered_executable("timer").get_path(), pyutilib.search_file("timer"))
     39        if pyutilib.services.registered_executable("pico_convert"):
     40            self.failUnlessEqual( pyutilib.services.registered_executable("pico_convert").get_path(), pyutilib.misc.search_file("pico_convert"))
     41        if pyutilib.services.registered_executable("glpsol"):
     42            self.failUnlessEqual( pyutilib.services.registered_executable("glpsol").get_path(), pyutilib.misc.search_file("glpsol"))
     43        if pyutilib.services.registered_executable("ampl"):
     44            self.failUnlessEqual( pyutilib.services.registered_executable("ampl").get_path(), pyutilib.misc.search_file("ampl"))
     45        if pyutilib.services.registered_executable("timer"):
     46            self.failUnlessEqual( pyutilib.services.registered_executable("timer").get_path(), pyutilib.misc.search_file("timer"))
    4547
    4648
  • trunk/test/core/base/test_convert.py

    r1657 r1768  
    1717from coopr.opt import ProblemFormat, ConverterError
    1818import coopr
    19 import pyutilib_th
    20 import pyutilib
     19import pyutilib.th
     20import pyutilib.services
     21import pyutilib.plugin.config
     22import pyutilib.plugin.core
     23import pyutilib.common
    2124import xml
    2225import filecmp
     
    6669
    6770
    68 class OptConvertDebug(pyutilib_th.TestCase):
     71class OptConvertDebug(pyutilib.th.TestCase):
    6972
    7073    def setUp(self):
    71         pyutilib.TempfileManager.tempdir = currdir
     74        pyutilib.services.TempfileManager.tempdir = currdir
    7275
    7376    def tearDown(self):
    74         pyutilib.TempfileManager.clear_tempfiles()
     77        pyutilib.services.TempfileManager.clear_tempfiles()
    7578        #
    7679        # Reset all options
    7780        #
    78         for ep in pyutilib.plugin.ExtensionPoint(pyutilib.plugin.IOption):
     81        for ep in pyutilib.plugin.core.ExtensionPoint(pyutilib.plugin.config.IOption):
    7982            ep.reset()
    8083
     
    142145          ans = coopr.opt.convert_problem( (currdir+"unknown.nl",), None, [ProblemFormat.cpxlp])
    143146          self.fail("Expected ConverterError exception")
    144         except pyutilib.ApplicationError:
    145            if pyutilib.registered_executable("pico_convert").enabled():
     147        except pyutilib.common.ApplicationError:
     148           if pyutilib.services.registered_executable("pico_convert").enabled():
    146149              self.fail("Expected ApplicationError because pico_convert is not available")
    147150           return
     
    151154    def test_error9(self):
    152155        """ The Opt configuration has not been initialized """
    153         cmd = pyutilib.registered_executable("pico_convert")
     156        cmd = pyutilib.services.registered_executable("pico_convert")
    154157        if not cmd is None:
    155158            cmd.disable()
     
    176179          ans = coopr.opt.convert_problem( (currdir+"test3.mod",currdir+"test5.dat"), None, [ProblemFormat.cpxlp])
    177180          self.fail("Expected ConverterError exception because we provided a MOD file with a 'data;' declaration")
    178         except pyutilib.ApplicationError:
     181        except pyutilib.common.ApplicationError:
    179182           if pyutilib.registered_executable("glpsol").enabled():
    180183              self.fail("Expected ApplicationError because glpsol is not available")
  • trunk/test/core/base/test_factory.py

    r1657 r1768  
    1515import coopr.opt
    1616import coopr
    17 import pyutilib
     17import pyutilib.services
     18import pyutilib.plugin.core
    1819
    1920
     
    5354
    5455    def setUp(self):
    55         pyutilib.TempfileManager.tempdir = currdir
     56        pyutilib.services.TempfileManager.tempdir = currdir
    5657
    5758    def tearDown(self):
    58         pyutilib.TempfileManager.clear_tempfiles()
     59        pyutilib.services.TempfileManager.clear_tempfiles()
    5960
    6061    def test_solver_factory(self):
     
    8586        Testing methods in the solverwriter factory registration process
    8687        """
    87         ep = pyutilib.plugin.ExtensionPoint(coopr.opt.ISolverRegistration)
     88        ep = pyutilib.plugin.core.ExtensionPoint(coopr.opt.ISolverRegistration)
    8889        service = ep.service("stest")
    8990        self.failUnlessEqual(service.type(), "stest")
     
    115116        Testing methods in the writer factory registration process
    116117        """
    117         ep = pyutilib.plugin.ExtensionPoint(coopr.opt.IWriterRegistration)
     118        ep = pyutilib.plugin.core.ExtensionPoint(coopr.opt.IWriterRegistration)
    118119        service = ep.service("wtest")
    119120        self.failUnlessEqual(service.type(), "wtest")
     
    144145        Testing methods in the reader factory registration process
    145146        """
    146         ep = pyutilib.plugin.ExtensionPoint(coopr.opt.IReaderRegistration)
     147        ep = pyutilib.plugin.core.ExtensionPoint(coopr.opt.IReaderRegistration)
    147148        service = ep.service("rtest")
    148149        self.failUnlessEqual(service.type(), "rtest")
  • trunk/test/core/base/test_os.py

    r1657 r1768  
    1515import coopr.opt
    1616import coopr
    17 import pyutilib_th
    1817import xml
    19 import pyutilib
     18import pyutilib.th
     19import pyutilib.services
    2020
    21 pyutilib.TempfileManager.tempdir = currdir
     21pyutilib.services.TempfileManager.tempdir = currdir
    2222
    23 class OptOSDebug(pyutilib_th.TestCase):
     23class OptOSDebug(pyutilib.th.TestCase):
    2424
    2525    def setUp(self):
    26         pyutilib.TempfileManager.tempdir = currdir
     26        pyutilib.services.TempfileManager.tempdir = currdir
    2727        #
    2828        # Create OSrL object
     
    4040
    4141    def tearDown(self):
    42         pyutilib.TempfileManager.clear_tempfiles()
     42        pyutilib.services.TempfileManager.clear_tempfiles()
    4343
    4444    def test_write_solution(self):
  • trunk/test/core/base/test_sol.py

    r1657 r1768  
    1515import coopr.opt
    1616import coopr
    17 import pyutilib_th
    1817import xml
    19 import pyutilib
     18import pyutilib.th
     19import pyutilib.services
    2020
    2121
    22 class OptSolDebug(pyutilib_th.TestCase):
     22class OptSolDebug(pyutilib.th.TestCase):
    2323
    2424    def setUp(self):
    25         pyutilib.TempfileManager.tempdir = currdir
     25        pyutilib.services.TempfileManager.tempdir = currdir
    2626
    2727    def tearDown(self):
    28         pyutilib.TempfileManager.clear_tempfiles()
     28        pyutilib.services.TempfileManager.clear_tempfiles()
    2929        if os.path.exists(currdir+"test_sol.txt"):
    3030           os.remove(currdir+"test_sol.txt")
  • trunk/test/core/base/test_soln.py

    r1657 r1768  
    1515import coopr.opt
    1616import coopr
    17 import pyutilib_th
     17import pyutilib.th
     18import pyutilib.misc
     19import pyutilib.services
    1820import xml
    19 import pyutilib
    2021
    21 class OptSolnDebug(pyutilib_th.TestCase):
     22class OptSolnDebug(pyutilib.th.TestCase):
    2223
    2324    def setUp(self):
    24         pyutilib.TempfileManager.tempdir = currdir
     25        pyutilib.services.TempfileManager.tempdir = currdir
    2526        self.results = coopr.opt.SolverResults()
    2627        self.soln = self.results.solution.create()
     
    3031        self.soln.variable[1]=0.0
    3132        self.soln.variable[3]=0.0
    32         pyutilib.TempfileManager.clear_tempfiles()
     33        pyutilib.services.TempfileManager.clear_tempfiles()
    3334
    3435    def tearDown(self):
     
    9394        self.soln.variable.add(1,0.0)
    9495        self.soln.variable.add(3,0.0)
    95         pyutilib.setup_redirect(currdir+"soln_pprint2.out")
     96        pyutilib.misc.setup_redirect(currdir+"soln_pprint2.out")
    9697        self.soln.pprint()
    9798        self.soln._variable.pprint()
    98         pyutilib.reset_redirect()
     99        pyutilib.misc.reset_redirect()
    99100        self.failUnlessFileEqualsBaseline(currdir+"soln_pprint2.out", currdir+"soln_pprint2.txt")
    100101
  • trunk/test/core/base/test_solver.py

    r1657 r1768  
    1515import coopr.opt
    1616import coopr
    17 import pyutilib
     17import pyutilib.services
    1818
    1919
     
    3737
    3838    def setUp(self):
    39         pyutilib.TempfileManager.tempdir = currdir
     39        pyutilib.services.TempfileManager.tempdir = currdir
    4040
    4141    def tearDown(self):
    42         pyutilib.TempfileManager.clear_tempfiles()
     42        pyutilib.services.TempfileManager.clear_tempfiles()
    4343
    4444
     
    7575            ans.available()
    7676            self.fail("Expected exception for 'stest' solver, which is disabled")
    77         except pyutilib.ApplicationError:
     77        except pyutilib.common.ApplicationError:
    7878            pass
    7979
  • trunk/test/core/colin/test_parallel.py

    r1657 r1768  
    1414import unittest
    1515from nose.tools import nottest
    16 import pyutilib_th
     16import xml
    1717import coopr.opt
    18 import xml
    1918from coopr.opt import ResultsFormat, ProblemFormat
    20 import pyutilib
     19import pyutilib.th
     20import pyutilib.plugin.core
     21import pyutilib.services
    2122
    2223
     
    104105
    105106
    106 class OptPatternSearchDebug(pyutilib_th.TestCase):
     107class OptPatternSearchDebug(pyutilib.th.TestCase):
    107108
    108109
     
    114115    def setUp(self):
    115116        self.do_setup(False)
    116         pyutilib.TempfileManager.tempdir = currdir
     117        pyutilib.services.TempfileManager.tempdir = currdir
    117118
    118119    def do_setup(self,flag):
    119         pyutilib.TempfileManager.tempdir = currdir
     120        pyutilib.services.TempfileManager.tempdir = currdir
    120121        self.ps = coopr.opt.colin.PatternSearch()
    121122
    122123    def tearDown(self):
    123         pyutilib.TempfileManager.clear_tempfiles()
     124        pyutilib.services.TempfileManager.clear_tempfiles()
    124125
    125126    def test_solve1(self):
     
    200201        Testing methods in the solverwriter factory registration process
    201202        """
    202         ep = pyutilib.plugin.ExtensionPoint(coopr.opt.parallel.solver.ISolverManagerRegistration)
     203        ep = pyutilib.plugin.core.ExtensionPoint(coopr.opt.parallel.solver.ISolverManagerRegistration)
    203204        service = ep.service("smtest")
    204205        self.failUnlessEqual(service.type(), "smtest")
  • trunk/test/core/colin/test_problem.py

    r1657 r1768  
    1414import unittest
    1515from nose.tools import nottest
    16 import pyutilib_th
    1716import coopr.opt
    18 #import coopr
    1917import xml
    2018from coopr.opt import ResultsFormat, ProblemFormat
    21 import pyutilib
     19import pyutilib.services
     20import pyutilib.th
    2221
    2322
     
    3736
    3837
    39 class TestColinProblem(pyutilib_th.TestCase):
     38class TestColinProblem(pyutilib.th.TestCase):
    4039
    4140    def setUp(self):
    4241        self.do_setup(False)
    43         pyutilib.TempfileManager.tempdir = currdir
     42        pyutilib.services.TempfileManager.tempdir = currdir
    4443
    4544    def do_setup(self,flag):
    46         pyutilib.TempfileManager.tempdir = currdir
     45        pyutilib.services.TempfileManager.tempdir = currdir
    4746        self.ps = coopr.opt.colin.PatternSearch()
    4847        self.problem=TestProblem1()
    4948
    5049    def tearDown(self):
    51         pyutilib.TempfileManager.clear_tempfiles()
     50        pyutilib.services.TempfileManager.clear_tempfiles()
    5251
    5352    def test_error1(self):
  • trunk/test/core/colin/test_ps.py

    r1657 r1768  
    1414import unittest
    1515from nose.tools import nottest
    16 import pyutilib_th
     16import xml
    1717import coopr.opt
    18 import xml
    1918from coopr.opt import ResultsFormat, ProblemFormat
    20 import pyutilib
     19import pyutilib.services
     20import pyutilib.th
    2121
    2222
     
    3636
    3737
    38 class OptPatternSearchDebug(pyutilib_th.TestCase):
     38class OptPatternSearchDebug(pyutilib.th.TestCase):
    3939
    4040    def setUp(self):
    4141        self.do_setup(False)
    42         pyutilib.TempfileManager.tempdir = currdir
     42        pyutilib.services.TempfileManager.tempdir = currdir
    4343
    4444    def do_setup(self,flag):
    45         pyutilib.TempfileManager.tempdir = currdir
     45        pyutilib.services.TempfileManager.tempdir = currdir
    4646        self.ps = coopr.opt.colin.PatternSearch()
    4747
    4848    def tearDown(self):
    49         pyutilib.TempfileManager.clear_tempfiles()
     49        pyutilib.services.TempfileManager.clear_tempfiles()
    5050
    5151    def test_solve1(self):
Note: See TracChangeset for help on using the changeset viewer.