Changeset 1768


Ignore:
Timestamp:
Oct 28, 2009 8:14:26 PM (11 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
Files:
92 edited

Legend:

Unmodified
Added
Removed
  • trunk/coopr/opt/__init__.py

    r1761 r1768  
    99#  _________________________________________________________________________
    1010
    11 import pyutilib.plugin
     11import pyutilib.plugin.core
    1212
    13 pyutilib.plugin.PluginGlobals.push_env( 'coopr.opt' )
     13pyutilib.plugin.core.PluginGlobals.push_env( 'coopr.opt' )
    1414
    1515from base import *
     
    1919from parallel import *
    2020
    21 pyutilib.plugin.PluginGlobals.pop_env()
     21pyutilib.plugin.core.PluginGlobals.pop_env()
    2222
    2323
  • trunk/coopr/opt/base/convert.py

    r1665 r1768  
    1515from formats import ProblemFormat
    1616from error import *
    17 from pyutilib.plugin import *
     17from pyutilib.plugin.core import *
    1818
    1919
  • trunk/coopr/opt/base/formats.py

    r1657 r1768  
    1414__all__ = ['ProblemFormat', 'ResultsFormat']
    1515
    16 from pyutilib.tpl.enum import Enum
     16from pyutilib.enum import Enum
    1717
    1818#
  • trunk/coopr/opt/base/opt_config.py

    r1217 r1768  
    99#  _________________________________________________________________________
    1010
    11 import pyutilib
     11import pyutilib.services
    1212
    1313#
     
    1515# namespace.
    1616#
    17 pyutilib.register_executable(name="PICO")
    18 pyutilib.register_executable(name="pico_convert")
    19 pyutilib.register_executable(name="glpsol")
    20 pyutilib.register_executable(name="ampl")
    21 pyutilib.register_executable(name="timer")
     17pyutilib.services.register_executable(name="PICO")
     18pyutilib.services.register_executable(name="pico_convert")
     19pyutilib.services.register_executable(name="glpsol")
     20pyutilib.services.register_executable(name="ampl")
     21pyutilib.services.register_executable(name="timer")
    2222
  • trunk/coopr/opt/base/problem.py

    r1289 r1768  
    1313            'WriterFactory' ]
    1414
    15 from pyutilib.plugin import *
     15from pyutilib.plugin.core import *
     16from pyutilib.plugin.config import *
    1617
    1718
  • trunk/coopr/opt/base/results.py

    r1217 r1768  
    1313            'ReaderFactory' ]
    1414
    15 from pyutilib.plugin import *
     15from pyutilib.plugin.core import *
     16from pyutilib.plugin.config import *
    1617
    1718
  • trunk/coopr/opt/base/solution.py

    r1675 r1768  
    1111__all__ = ['SolverResults', 'SolverStatus', 'ProblemSense', 'SolutionStatus', 'Solution']
    1212
    13 from pyutilib import format_io, as_numeric
    14 from pyutilib.tpl.enum import Enum
     13from pyutilib.misc import format_io
     14from pyutilib.math import as_numeric
     15from pyutilib.enum import Enum
    1516import sys
    1617import StringIO
  • trunk/coopr/opt/base/solver.py

    r1740 r1768  
    1414import os
    1515import sys
    16 import pyutilib
    1716from convert import convert_problem
    1817from formats import ResultsFormat, ProblemFormat
    19 from pyutilib.tpl.enum import Enum
    2018import results
    2119from solution import SolverResults, SolverStatus
    22 from pyutilib.plugin import *
     20from pyutilib.enum import Enum
     21from pyutilib.plugin.core import *
     22from pyutilib.plugin.config import *
     23import pyutilib.common
     24import pyutilib.misc
    2325
    2426
     
    127129        tmp = self.enabled()
    128130        if exception_flag and not tmp:
    129             raise pyutilib.ApplicationError, "OptSolver plugin %s is disabled" % self.name
     131            raise pyutilib.common.ApplicationError, "OptSolver plugin %s is disabled" % self.name
    130132        return tmp
    131133
     
    208210        if istr is '':
    209211            return
    210         tokens = pyutilib.quote_split('[ ]+',istr)
     212        tokens = pyutilib.misc.quote_split('[ ]+',istr)
    211213        for token in tokens:
    212214            index = token.find('=')
  • trunk/coopr/opt/colin/problem.py

    r1217 r1768  
    1717import xml.dom.minidom
    1818import sys
    19 from pyutilib.tpl.enum import Enum
    20 from pyutilib import tostr, get_xml_text
     19from pyutilib.enum import Enum
     20from pyutilib.misc import tostr, get_xml_text
    2121
    2222
  • trunk/coopr/opt/parallel/__init__.py

    r1296 r1768  
    99#  _________________________________________________________________________
    1010
    11 import pyutilib.plugin
     11import pyutilib.plugin.core
    1212
    13 pyutilib.plugin.PluginGlobals.push_env( "coopr.opt" )
     13pyutilib.plugin.core.PluginGlobals.push_env( "coopr.opt" )
    1414
    1515from solver import *
     
    1717import local
    1818
    19 pyutilib.plugin.PluginGlobals.pop_env()
     19pyutilib.plugin.core.PluginGlobals.pop_env()
  • trunk/coopr/opt/parallel/local.py

    r1454 r1768  
    1212__all__ = []
    1313
    14 import pyutilib.plugin
    1514from manager import *
    1615from solver import *
  • trunk/coopr/opt/parallel/manager.py

    r1457 r1768  
    1212__all__ = ['ActionManagerError', 'ActionHandle', 'AsynchronousActionManager', 'ActionStatus', 'FailedActionHandle']
    1313
    14 from pyutilib.tpl.enum import Enum
     14from pyutilib.enum import Enum
    1515
    1616
  • trunk/coopr/opt/parallel/solver.py

    r1296 r1768  
    1212__all__ = ['AsynchronousSolverManager', 'SolverManagerRegistration', 'SolverManagerFactory']
    1313
    14 import pyutilib.plugin
     14import pyutilib.plugin.core
     15import pyutilib.plugin.config
    1516from manager import *
    1617
     
    1920# An interface for AsynchronousSolverManager objects
    2021#
    21 class ISolverManager(pyutilib.plugin.Interface):
     22class ISolverManager(pyutilib.plugin.core.Interface):
    2223    pass
    2324
    2425
    25 class ISolverManagerRegistration(pyutilib.plugin.Interface):
     26class ISolverManagerRegistration(pyutilib.plugin.core.Interface):
    2627
    2728    def create(self, name=None):
     
    3334
    3435def SolverManagerFactory(name=None, instance_name=None):
    35     ep = pyutilib.plugin.ExtensionPoint(ISolverManagerRegistration)
     36    ep = pyutilib.plugin.core.ExtensionPoint(ISolverManagerRegistration)
    3637    if name is None:
    3738        return map(lambda x:x.name, ep())
     
    4243
    4344
    44 class SolverManagerRegistration(pyutilib.plugin.Plugin):
     45class SolverManagerRegistration(pyutilib.plugin.core.Plugin):
    4546
    46     pyutilib.plugin.implements(ISolverManagerRegistration)
     47    pyutilib.plugin.core.implements(ISolverManagerRegistration)
    4748
    4849    def __init__(self, type, cls):
     
    6162
    6263
    63 class AsynchronousSolverManager(AsynchronousActionManager, pyutilib.plugin.ManagedPlugin):
     64class AsynchronousSolverManager(AsynchronousActionManager, pyutilib.plugin.config.ManagedPlugin):
    6465
    65     pyutilib.plugin.implements(ISolverManager)
     66    pyutilib.plugin.core.implements(ISolverManager)
    6667
    6768    def __init__(self, **kwds):
    6869        AsynchronousActionManager.__init__(self)
    69         pyutilib.plugin.ManagedPlugin.__init__(self, **kwds)
     70        pyutilib.plugin.config.ManagedPlugin.__init__(self, **kwds)
    7071
    7172    def solve(self, *args, **kwds):
  • trunk/coopr/opt/reader/OS.py

    r1657 r1768  
    1818from xml.dom import minidom, Node
    1919import xml
    20 from pyutilib.tpl.enum import Enum
    21 from pyutilib import get_xml_text
     20from pyutilib.enum import Enum
     21from pyutilib.misc import get_xml_text
    2222from coopr.opt.base import SolutionStatus
    2323
  • trunk/coopr/opt/solver/ilmcmd.py

    r1605 r1768  
    1212
    1313import shellcmd
    14 import pyutilib
     14import pyutilib.services
     15import pyutilib.subprocess
     16import pyutilib.common
    1517import re
    1618import sys
     
    2931        if not shellcmd.SystemCallSolver.available(self, exception_flag):
    3032            return False
    31         executable = pyutilib.registered_executable("ilmlist")
     33        executable = pyutilib.services.registered_executable("ilmlist")
    3234        if not executable is None:
    3335            try:
    34                 [rc,log] = pyutilib.run_command(executable.get_path())
    35             except pyutilib.WindowsError, err:
    36                 raise pyutilib.ApplicationError, "Could not execute the command: ilmtest\n\tError message: "+   str(err)
     36                [rc,log] = pyutilib.subprocess.run(executable.get_path())
     37            except pyutilib.common.WindowsError, err:
     38                raise pyutilib.common.ApplicationError, "Could not execute the command: ilmtest\n\tError message: "+   str(err)
    3739            sys.stdout.flush()
    3840            for line in log.split("\n"):
     
    4648        return True
    4749
    48 pyutilib.register_executable(name="ilmlist")
     50pyutilib.services.register_executable(name="ilmlist")
  • trunk/coopr/opt/solver/shellcmd.py

    r1670 r1768  
    1313import sys
    1414import os
    15 import pyutilib
     15import pyutilib.common
     16import pyutilib.services
     17import pyutilib.subprocess
     18import pyutilib.plugin.core
     19import pyutilib.misc
    1620from coopr.opt.base import *
    1721from coopr.opt.base.solver import *
     
    4448           if exception_flag:
    4549              if self.executable() is None:
    46                  raise pyutilib.ApplicationError, "No executable found for solver `"+self.name+"'"
     50                 raise pyutilib.common.ApplicationError, "No executable found for solver `"+self.name+"'"
    4751              else:
    48                  raise pyutilib.ApplicationError, "Bad path for application `PICO' used by solver "+self.name+"': "+self.executable()
     52                 raise pyutilib.common.ApplicationError, "Bad path for application `PICO' used by solver "+self.name+"': "+self.executable()
    4953           return False
    5054        return True
     
    103107           
    104108    def _apply_solver(self):
    105         if pyutilib.registered_executable("timer"):
    106             self._timer=pyutilib.registered_executable("timer").get_path()
     109        if pyutilib.services.registered_executable("timer"):
     110            self._timer=pyutilib.services.registered_executable("timer").get_path()
    107111        #
    108112        # Execute the command
    109113        #
    110         pyutilib.plugin.PluginGlobals.env("coopr.opt").log.debug("Running "+self._command.cmd)
     114        pyutilib.plugin.core.PluginGlobals.env("coopr.opt").log.debug("Running "+self._command.cmd)
    111115
    112116        # display the log/solver file names prior to execution. this is useful
     
    123127        [rc,log] = self._execute_command(self._command)
    124128        sys.stdout.flush()
    125         self._status = pyutilib.Bunch(rc=rc, log=log)
     129        self._status = pyutilib.misc.Bunch(rc=rc, log=log)
    126130
    127131    def _postsolve(self):
     
    145149           results = self.process_output(self._status.rc)
    146150           if not self.keepFiles:
    147               pyutilib.TempfileManager.clear_tempfiles()
     151              pyutilib.services.TempfileManager.clear_tempfiles()
    148152
    149153        return results
     
    154158        """
    155159        try:
    156             [rc, log] = pyutilib.run_command(command.cmd, timelimit=self._timelimit, env=command.env, tee=self.tee, shell=True)
    157         except pyutilib.WindowsError, err:
    158             raise pyutilib.ApplicationError, "Could not execute the command: "+command.cmd+"\tError message: "+str(err)
     160            [rc, log] = pyutilib.subprocess.run(command.cmd, timelimit=self._timelimit, env=command.env, tee=self.tee, shell=True)
     161        except pyutilib.common.WindowsError, err:
     162            raise pyutilib.Acommon.pplicationError, "Could not execute the command: "+command.cmd+"\tError message: "+str(err)
    159163        sys.stdout.flush()
    160164        return [rc,log]
  • trunk/coopr/plugins/__init__.py

    r1653 r1768  
    1717    __path__ = pkgutil.extend_path(__path__, __name__)
    1818
    19 #import pyutilib.plugin
    20 #
    21 #pyutilib.plugin.PluginGlobals.push_env( "coopr.opt" )
    22 #
    23 #import mip
    24 #import converter
    25 #import smanager
    26 #
    27 #pyutilib.plugin.PluginGlobals.pop_env()
  • trunk/coopr/plugins/converter/__init__.py

    r1653 r1768  
    99#  _________________________________________________________________________
    1010
    11 import pyutilib.plugin
    12 pyutilib.plugin.PluginGlobals.push_env( 'coopr.opt' )
     11import pyutilib.plugin.core
     12pyutilib.plugin.core.PluginGlobals.push_env( 'coopr.opt' )
    1313
    1414import glpsol
     
    1616import pyomo
    1717
    18 pyutilib.plugin.PluginGlobals.pop_env()
     18pyutilib.plugin.core.PluginGlobals.pop_env()
  • trunk/coopr/plugins/converter/glpsol.py

    r1657 r1768  
    1212
    1313from coopr.opt.base import *
    14 from pyutilib.plugin import *
    15 import pyutilib
     14from pyutilib.plugin.core import *
     15from pyutilib.plugin.config import *
     16from pyutilib.plugin.executables import *
     17import pyutilib.subprocess
     18import pyutilib.common
    1619
    1720
     
    9396            OUTPUT.close()
    9497            cmd = cmd+" glpsol.mod"
    95         pyutilib.run_command(cmd)
     98        pyutilib.subprocess.run(cmd)
    9699        if not os.path.exists(ofile):       #pragma:nocover
    97             raise pyutilib.ApplicationError, "Problem launching 'glpsol' to create "+ofile
     100            raise pyutilib.common.ApplicationError, "Problem launching 'glpsol' to create "+ofile
    98101        if os.path.exists("glpsol.mod"):
    99102            os.remove("glpsol.mod")
  • trunk/coopr/plugins/converter/pico.py

    r1657 r1768  
    1212
    1313from coopr.opt.base import *
    14 from pyutilib.plugin import *
    15 import pyutilib
     14from pyutilib.plugin.core import *
     15from pyutilib.plugin.config import *
     16from pyutilib.plugin.executables import *
     17import pyutilib.services
     18import pyutilib.common
     19import pyutilib.subprocess
    1620
    1721
     
    6064            target="lp"
    6165        # NOTE: if you have an extra "." in the suffix, the pico_convert program fails to output to the correct filename.
    62         output_filename = pyutilib.TempfileManager.create_tempfile(suffix = 'pico_convert.' + target)
     66        output_filename = pyutilib.services.TempfileManager.create_tempfile(suffix = 'pico_convert.' + target)
    6367        if not isinstance(args[2],basestring):
    64             fname= pyutilib.TempfileManager.create_tempfile(suffix= 'pico_convert.' +str(args[0]))
     68            fname= pyutilib.services.TempfileManager.create_tempfile(suffix= 'pico_convert.' +str(args[0]))
    6569            args[2].write(filename=fname, format=args[1])
    6670            cmd = pico_convert_cmd +" --output="+output_filename+" "+target+" "+fname
     
    7276                cmd = cmd + " "+item
    7377        print "Running command: "+cmd
    74         pyutilib.run_command(cmd)
     78        pyutilib.subprocess.run(cmd)
    7579        if not os.path.exists(output_filename):       #pragma:nocover
    76             raise pyutilib.ApplicationError, \
     80            raise pyutilib.common.ApplicationError, \
    7781                    "Problem launching 'pico_convert' to create "+output_filename
    7882        return (output_filename,)
  • trunk/coopr/plugins/converter/pyomo.py

    r1657 r1768  
    1313
    1414from coopr.opt.base import *
    15 from pyutilib.plugin import *
     15from pyutilib.plugin.core import *
     16from pyutilib.plugin.config import *
     17from pyutilib.plugin.executables import *
     18import pyutilib.services
    1619from pico import PicoMIPConverter
    1720
     
    4649        """
    4750        if args[1] is ProblemFormat.cpxlp:
    48             problem_filename = pyutilib.TempfileManager.create_tempfile(suffix = '.pyomo.lp')
     51            problem_filename = pyutilib.services.TempfileManager.create_tempfile(suffix = '.pyomo.lp')
    4952            args[2].write(filename=problem_filename,format=ProblemFormat.cpxlp)
    5053            return (problem_filename,)
    5154        elif args[1] is ProblemFormat.mps:
    52             problem_filename = pyutilib.TempfileManager.create_tempfile(suffix = '.pyomo.nl')
     55            problem_filename = pyutilib.services.TempfileManager.create_tempfile(suffix = '.pyomo.nl')
    5356            args[2].write(filename=problem_filename,format=ProblemFormat.nl)
    5457            ans = self.pico_converter.apply(ProblemFormat.nl,ProblemFormat.mps,problem_filename)
     
    5659            return ans
    5760        elif args[1] is ProblemFormat.nl:
    58             problem_filename = pyutilib.TempfileManager.create_tempfile(suffix = '.pyomo.nl')
     61            problem_filename = pyutilib.services.TempfileManager.create_tempfile(suffix = '.pyomo.nl')
    5962            args[2].write(filename=problem_filename,format=ProblemFormat.nl)
    6063            return (problem_filename,)
  • trunk/coopr/plugins/mip/CBC.py

    r1718 r1768  
    1414from coopr.opt.base import *
    1515from coopr.opt.solver import *
    16 import pyutilib
     16import pyutilib.services
     17import pyutilib.misc
     18import pyutilib.common
     19import pyutilib.plugin.core
    1720import mockmip
    1821
     
    3841
    3942    def executable(self):
    40         executable = pyutilib.registered_executable("cbc")
     43        executable = pyutilib.services.registered_executable("cbc")
    4144        if executable is None:
    42             pyutilib.plugin.PluginGlobals.env().log.error("Could not locate the 'cbc' executable, which is required for solver %s" % self.name)
     45            pyutilib.plugin.core.PluginGlobals.env().log.error("Could not locate the 'cbc' executable, which is required for solver %s" % self.name)
    4346            self.enable = False
    4447            return None
     
    5053        #
    5154        if self.log_file is None:
    52            self.log_file = pyutilib.TempfileManager.create_tempfile(suffix=".cbc.log")
     55           self.log_file = pyutilib.services.TempfileManager.create_tempfile(suffix=".cbc.log")
    5356        fname = problem_files[0].split(os.sep)[-1]
    5457        if '.' in fname:
     
    6265        #
    6366        if self.soln_file is None:
    64            self.soln_file = pyutilib.TempfileManager.create_tempfile(suffix=fname+".cbc.soln")
     67           self.soln_file = pyutilib.services.TempfileManager.create_tempfile(suffix=fname+".cbc.soln")
    6568        self.sol_file = fname+".sol"
    6669        #
     
    106109                    opt += " -"+key+" "+str(self.options[key])
    107110            proc = self._timer + " " + executable + opt + " -printingOptions all "+timing+ " -import "+problem_files[0]+ " -import -stat -solve -solu " + self.soln_file
    108         return pyutilib.Bunch(cmd=proc, log_file=self.log_file, env=None)
     111        return pyutilib.misc.Bunch(cmd=proc, log_file=self.log_file, env=None)
    109112
    110113    def _execute_command(self,cmd):
     
    281284        try:
    282285           CBC.__init__(self,**kwds)
    283         except pyutilib.ApplicationError: #pragma:nocover
     286        except pyutilib.common.ApplicationError: #pragma:nocover
    284287           pass                        #pragma:nocover
    285288        mockmip.MockMIP.__init__(self,"cbc")
     
    306309
    307310
    308 pyutilib.register_executable(name="cbc")
     311pyutilib.services.register_executable(name="cbc")
    309312SolverRegistration("cbc", CBC)
    310313SolverRegistration("_mock_cbc", MockCBC)
  • trunk/coopr/plugins/mip/CPLEX.py

    r1719 r1768  
    1515from coopr.opt.solver import *
    1616import mockmip
    17 import pyutilib
     17import pyutilib.services
     18import pyutilib.common
     19import pyutilib.misc
     20import pyutilib.plugin.core
    1821import string
    1922import re
     
    7679       import coopr.pyomo.base.var
    7780
    78        self.mst_file_name = pyutilib.TempfileManager.create_tempfile(suffix = '.cplex.mst')
     81       self.mst_file_name = pyutilib.services.TempfileManager.create_tempfile(suffix = '.cplex.mst')
    7982
    8083       doc = xml.dom.minidom.Document()
     
    148151
    149152    def executable(self):
    150         executable = pyutilib.registered_executable("cplex")
     153        executable = pyutilib.services.registered_executable("cplex")
    151154        if executable is None:
    152             pyutilib.plugin.PluginGlobals.env().log.error("Could not locate the 'cplex' executable, which is required for solver %s" % self.name)
     155            pyutilib.plugin.core.PluginGlobals.env().log.error("Could not locate the 'cplex' executable, which is required for solver %s" % self.name)
    153156            self.enable = False
    154157            return None
     
    160163        # The log file in CPLEX contains the solution trace, but the solver status can be found in the solution file.
    161164        #
    162         self.log_file = pyutilib.TempfileManager.create_tempfile(suffix = '.cplex.log')
     165        self.log_file = pyutilib.services.TempfileManager.create_tempfile(suffix = '.cplex.log')
    163166
    164167        #
     
    166169        # As indicated above, contains (in XML) both the solution and solver status.
    167170        #
    168         self.soln_file = pyutilib.TempfileManager.create_tempfile(suffix = '.cplex.sol')
     171        self.soln_file = pyutilib.services.TempfileManager.create_tempfile(suffix = '.cplex.sol')
    169172
    170173        #
     
    179182        # Write the CPLEX execution script
    180183        #
    181         self.cplex_script_file_name = pyutilib.TempfileManager.create_tempfile(suffix = '.cplex.script')
     184        self.cplex_script_file_name = pyutilib.services.TempfileManager.create_tempfile(suffix = '.cplex.script')
    182185        cplex_script_file = open(self.cplex_script_file_name,'w')
    183186        cplex_script_file.write("set logfile "+self.log_file+"\n")
     
    219222        if self._problem_format in [ProblemFormat.cpxlp, ProblemFormat.mps]:
    220223           proc = self._timer + " " + self.executable() + " < " + self.cplex_script_file_name
    221         return pyutilib.Bunch(cmd=proc, log_file=self.log_file, env=None)
     224        return pyutilib.misc.Bunch(cmd=proc, log_file=self.log_file, env=None)
    222225
    223226    def process_logfile(self):
     
    396399        try:
    397400           CPLEX.__init__(self, **kwds)
    398         except pyutilib.ApplicationError: #pragma:nocover
     401        except pyutilib.common.ApplicationError: #pragma:nocover
    399402           pass                        #pragma:nocover
    400403        mockmip.MockMIP.__init__(self,"cplex")
     
    415418
    416419
    417 pyutilib.register_executable(name="cplex")
     420pyutilib.services.register_executable(name="cplex")
    418421SolverRegistration("cplex", CPLEX)
    419422SolverRegistration("_mock_cplex", MockCPLEX)
  • trunk/coopr/plugins/mip/GLPK.py

    r1657 r1768  
    1515from coopr.opt.solver import *
    1616import mockmip
    17 import pyutilib
     17import pyutilib.services
     18import pyutilib.misc
     19import pyutilib.common
     20import pyutilib.plugin.core
    1821
    1922
     
    3841
    3942    def executable(self):
    40         executable = pyutilib.registered_executable("glpsol")
     43        executable = pyutilib.services.registered_executable("glpsol")
    4144        if executable is None:
    42             pyutilib.plugin.PluginGlobals.env().log.error("Could not locate the 'glpsol' executable, which is required for solver %s" % self.name)
     45            pyutilib.plugin.core.PluginGlobals.env().log.error("Could not locate the 'glpsol' executable, which is required for solver %s" % self.name)
    4346            self.enable = False
    4447            return None
     
    5053        #
    5154        if self.log_file is None:
    52            self.log_file = pyutilib.TempfileManager.create_tempfile(suffix = '.glpk.log')
     55           self.log_file = pyutilib.services.TempfileManager.create_tempfile(suffix = '.glpk.log')
    5356
    5457        #
     
    5659        #
    5760        if self.soln_file is None:
    58             self.soln_file = pyutilib.TempfileManager.create_tempfile(suffix = '.glpk.soln')
     61            self.soln_file = pyutilib.services.TempfileManager.create_tempfile(suffix = '.glpk.soln')
    5962
    6063        #
     
    8689                opt += " --"+key+" "+str(self.options[key])
    8790        proc = self._timer + " " + executable + opt + " " + timing + " --output " + self.soln_file + problem
    88         return pyutilib.Bunch(cmd=proc, log_file=self.log_file, env=None)
     91        return pyutilib.misc.Bunch(cmd=proc, log_file=self.log_file, env=None)
    8992
    9093    def process_logfile(self):
     
    320323        try:
    321324           GLPK.__init__(self, **kwds)
    322         except pyutilib.ApplicationError: #pragma:nocover
     325        except pyutilib.common.ApplicationError: #pragma:nocover
    323326           pass                        #pragma:nocover
    324327        mockmip.MockMIP.__init__(self,"glpk")
     
    345348
    346349
    347 pyutilib.register_executable(name="glpsol")
     350pyutilib.services.register_executable(name="glpsol")
    348351SolverRegistration("glpk", GLPK)
    349352SolverRegistration("_mock_glpk", MockGLPK)
  • trunk/coopr/plugins/mip/NLWRITE.py

    r1657 r1768  
    1111
    1212import re
    13 import pyutilib
     13import pyutilib.misc
    1414from coopr.opt.base import *
    1515from coopr.opt.solver import *
     
    3030
    3131    def create_command_line(self,executable,problem_files):
    32         return pyutilib.Bunch(cmd="/bin/true", log_file=None, env=None)
     32        return pyutilib.misc.Bunch(cmd="/bin/true", log_file=None, env=None)
    3333
  • trunk/coopr/plugins/mip/PICO.py

    r1657 r1768  
    1313from coopr.opt.base import *
    1414from coopr.opt.solver import *
    15 import pyutilib
     15import pyutilib.services
     16import pyutilib.common
     17import pyutilib.common
     18import pyutilib.plugin.core
    1619import mockmip
    1720import os
     
    3942
    4043    def executable(self):
    41         executable = pyutilib.registered_executable("PICO")
     44        executable = pyutilib.services.registered_executable("PICO")
    4245        if executable is None:
    43             pyutilib.plugin.PluginGlobals.env().log.error("Could not locate the 'PICO' executable, which is required for solver %s" % self.name)
     46            pyutilib.plugin.core.PluginGlobals.env().log.error("Could not locate the 'PICO' executable, which is required for solver %s" % self.name)
    4447            self.enable = False
    4548            return None
     
    5154        #
    5255        if self.log_file is None:
    53            self.log_file = pyutilib.TempfileManager.create_tempfile(suffix="PICO.log")
     56           self.log_file = pyutilib.services.TempfileManager.create_tempfile(suffix="PICO.log")
    5457        fname = problem_files[0].split(os.sep)[-1]
    5558        if '.' in fname:
     
    6063                fname = tmp[0]
    6164        if self.soln_file is None:
    62            self.soln_file = pyutilib.TempfileManager.create_tempfile(suffix=fname+".soln")
     65           self.soln_file = pyutilib.services.TempfileManager.create_tempfile(suffix=fname+".soln")
    6366        self.sol_file = fname+".sol"
    6467        #
     
    102105                    opt += " --"+key+"="+str(self.options[key])
    103106           proc = self._timer + " " + executable + opt + " --output " + self.soln_file + " " + problem_files[0]
    104         return pyutilib.Bunch(cmd=proc, log_file=self.log_file, env=env)
     107        return pyutilib.misc.Bunch(cmd=proc, log_file=self.log_file, env=env)
    105108
    106109    def process_logfile(self):
     
    227230        try:
    228231           PICO.__init__(self,**kwds)
    229         except pyutilib.ApplicationError: #pragma:nocover
     232        except pyutilib.common.ApplicationError: #pragma:nocover
    230233           pass                        #pragma:nocover
    231234        mockmip.MockMIP.__init__(self,"pico")
     
    246249
    247250
    248 pyutilib.register_executable(name="pico")
     251pyutilib.services.register_executable(name="pico")
    249252SolverRegistration("pico", PICO)
    250253SolverRegistration("_mock_pico", MockPICO)
  • trunk/coopr/plugins/mip/__init__.py

    r1653 r1768  
    99#  _________________________________________________________________________
    1010
    11 import pyutilib.plugin
    12 pyutilib.plugin.PluginGlobals.push_env( 'coopr.opt' )
     11import pyutilib.plugin.core
     12pyutilib.plugin.core.PluginGlobals.push_env( 'coopr.opt' )
    1313
    1414from PICO import PICO, MockPICO
     
    1818#from NLWRITE import NLWRITE
    1919
    20 pyutilib.plugin.PluginGlobals.pop_env()
     20pyutilib.plugin.core.PluginGlobals.pop_env()
  • trunk/coopr/plugins/smanager/__init__.py

    r1653 r1768  
    99#  _________________________________________________________________________
    1010
    11 import pyutilib.plugin
    12 pyutilib.plugin.PluginGlobals.push_env( 'coopr.opt' )
     11import pyutilib.plugin.core
     12pyutilib.plugin.core.PluginGlobals.push_env( 'coopr.opt' )
    1313
    1414import pyro
    1515
    16 pyutilib.plugin.PluginGlobals.pop_env()
     16pyutilib.plugin.core.PluginGlobals.pop_env()
  • trunk/coopr/plugins/smanager/pyro.py

    r1657 r1768  
    1212__all__ = []
    1313
    14 import pyutilib.plugin
     14import pyutilib.misc
     15import pyutilib.plugin.core
    1516from coopr.opt.parallel.manager import *
    1617from coopr.opt.parallel.solver import *
    1718from coopr.opt.base import SolverResults
    1819
    19 import pyutilib
    2020import pickle
    2121
     
    6060        #
    6161        del kwds['available']
    62         data=pyutilib.Bunch(opt=self._opt.type, file=filestr, filename=self._opt._problem_files[0], kwds=kwds)
     62        data=pyutilib.misc.Bunch(opt=self._opt.type, file=filestr, filename=self._opt._problem_files[0], kwds=kwds)
    6363        task = pyutilib.pyro.Task(data=data, id=ah.id)
    6464        self.client.add_task(task)
  • trunk/coopr/pyomo/__init__.py

    r1761 r1768  
    99#  _________________________________________________________________________
    1010
    11 import pyutilib.plugin
     11import pyutilib.plugin.core
    1212
    1313
    14 pyutilib.plugin.PluginGlobals.push_env( 'coopr.pyomo' )
     14pyutilib.plugin.core.PluginGlobals.push_env( 'coopr.pyomo' )
    1515
    1616from base import *
     
    2121import coopr.opt
    2222
    23 pyutilib.plugin.PluginGlobals.pop_env()
     23pyutilib.plugin.core.PluginGlobals.pop_env()
    2424
    2525
  • trunk/coopr/pyomo/base/PyomoModel.py

    r1755 r1768  
    1616from numvalue import *
    1717
    18 import pyutilib
    19 from pyutilib.numtypes import *
    20 from pyutilib import quote_split, tuplize
     18import pyutilib.plugin.core
     19from pyutilib.math import *
     20from pyutilib.misc import quote_split, tuplize
    2121
    2222from coopr.opt import ProblemFormat, ResultsFormat
     
    3838    """
    3939
    40     presolver_ep = pyutilib.plugin.ExtensionPoint(IPyomoPresolver)
     40    presolver_ep = pyutilib.plugin.core.ExtensionPoint(IPyomoPresolver)
    4141
    4242
     
    4747        #
    4848        self._component={}
    49         for item in pyutilib.plugin.ExtensionPoint(IModelComponent):
     49        for item in pyutilib.plugin.core.ExtensionPoint(IModelComponent):
    5050            self._component[ item.cls() ] = {}
    5151        #
     
    350350        #
    351351        items = [_BaseSet, RangeSet, _ParamBase, _VarBase, Objective, Constraint]
    352         for item in pyutilib.plugin.ExtensionPoint(IModelComponent):
     352        for item in pyutilib.plugin.core.ExtensionPoint(IModelComponent):
    353353            if not item in items:
    354354                items.append(item)
  • trunk/coopr/pyomo/base/PyomoModelData.py

    r1515 r1768  
    1313import math
    1414import os
    15 from pyutilib import quote_split
     15from pyutilib.misc import quote_split
    1616import pyomo
    17 from pyutilib import ExcelSpreadsheet
     17from pyutilib.excel import ExcelSpreadsheet
    1818import coopr
    1919
  • trunk/coopr/pyomo/base/constraint.py

    r1528 r1768  
    1717from var import Var, _VarValue
    1818from sets import Set, _BaseSet
    19 import pyutilib
     19import pyutilib.misc
     20import pyutilib.math
    2021from numtypes import *
    2122import sys
     
    170171        print >>ostream, "  Size="+str(len(self))
    171172        if None in self._data:
    172            print >>ostream, prefix+"  Value="+pyutilib.format_io(self._data[None].expr(exception=False))
     173           print >>ostream, prefix+"  Value="+pyutilib.misc.format_io(self._data[None].expr(exception=False))
    173174        else:
    174175           for key in self._data:
     
    444445        #
    445446        if type(tpl[0]) in [bool,int,long,float]:
    446             if pyutilib.is_finite(tpl[0]):
     447            if pyutilib.math.is_finite(tpl[0]):
    447448                tpl[0] = NumericConstant(value=float(tpl[0]))
    448449            else:
    449450                tpl[0] = None
    450         elif type(tpl[0]) is NumericConstant and not pyutilib.is_finite(tpl[0]()):
     451        elif type(tpl[0]) is NumericConstant and not pyutilib.math.is_finite(tpl[0]()):
    451452                tpl[0] = None
    452453        if type(tpl[1]) in [bool,int,long,float]:
     
    455456            tpl[2] = tpl[0]
    456457        elif type(tpl[2]) in [bool,int,long,float]:
    457             if pyutilib.is_finite(tpl[2]):
     458            if pyutilib.math.is_finite(tpl[2]):
    458459                tpl[2] = NumericConstant(value=float(tpl[2]))
    459460            else:
    460461                tpl[2] = None
    461         elif type(tpl[2]) is NumericConstant and not pyutilib.is_finite(tpl[2]()):
     462        elif type(tpl[2]) is NumericConstant and not pyutilib.math.is_finite(tpl[2]()):
    462463                tpl[2] = None
    463464        #
     
    526527        print >>ostream, "  Size="+str(len(self))
    527528        if None in self._data:
    528            print >>ostream, prefix+"  Value="+pyutilib.format_io(self._data[None].body())
     529           print >>ostream, prefix+"  Value="+pyutilib.misc.format_io(self._data[None].body())
    529530        else:
    530531           print >>ostream, prefix+"        \tLower\tBody\t\tUpper"
  • trunk/coopr/pyomo/base/expr.py

    r1515 r1768  
    1414
    1515from plugin import *
    16 from pyutilib.plugin import *
     16from pyutilib.plugin.core import *
    1717from numvalue import *
    1818from param import _ParamBase
  • trunk/coopr/pyomo/base/numvalue.py

    r1438 r1768  
    1212
    1313import plugin
    14 import pyutilib.plugin
     14#import pyutilib.plugin.core
     15import pyutilib.math
    1516import sys
    1617from set_types import Reals
     
    6566            self.domain=None
    6667        if 'value' in kwds:
    67             if pyutilib.is_nan(kwds['value']):
    68                 self.value=pyutilib.nan
     68            if pyutilib.math.is_nan(kwds['value']):
     69                self.value=pyutilib.math.nan
    6970            else:
    7071                self.set_value(kwds['value'])
  • trunk/coopr/pyomo/base/param.py

    r1751 r1768  
    1818import types
    1919from sets import _BaseSet
    20 import pyutilib
     20
    2121
    2222class _ParamValue(NumericConstant):
  • trunk/coopr/pyomo/base/plugin.py

    r1410 r1768  
    1414        'IPyomoPresolver', 'IPyomoPresolveAction']
    1515
    16 from pyutilib.plugin import *
     16from pyutilib.plugin.core import *
    1717
    1818
  • trunk/coopr/pyomo/base/pyomo.py

    r1217 r1768  
    99#  _________________________________________________________________________
    1010
    11 from pyutilib.tpl.enum import Enum
    12 import pyutilib.plugin
     11from pyutilib.enum import Enum
     12import pyutilib.plugin.core
    1313from plugin import *
    1414
     
    4545
    4646def predefined_sets():
    47     ep = pyutilib.plugin.ExtensionPoint(IPyomoSet)
     47    ep = pyutilib.plugin.core.ExtensionPoint(IPyomoSet)
    4848    ans = []
    4949    for item in ep:
     
    5353
    5454def model_components():
    55     ep = pyutilib.plugin.ExtensionPoint(IModelComponent)
     55    ep = pyutilib.plugin.core.ExtensionPoint(IModelComponent)
    5656    ans = []
    5757    for item in ep:
  • trunk/coopr/pyomo/base/rangeset.py

    r1455 r1768  
    1111__all__ = ['RangeSet']
    1212
    13 import pyutilib.plugin
     13#import pyutilib.plugin.core
    1414import sets
    1515import expr
  • trunk/coopr/pyomo/base/set_types.py

    r1455 r1768  
    1111__all__ = ['_VirtualSet', '_AnySet', 'RealSet', 'IntegerSet', 'BooleanSet', 'Any', 'Reals', 'PositiveReals', 'NonPositiveReals', 'NegativeReals', 'NonNegativeReals', 'PercentFraction', 'Integers', 'PositiveIntegers', 'NonPositiveIntegers', 'NegativeIntegers', 'NonNegativeIntegers', 'Boolean', 'Binary']
    1212
    13 import pyutilib.plugin
     13import pyutilib.plugin.core
    1414import sets
    1515from coopr.pyomo.base.plugin import *
    1616
    1717
    18 class _VirtualSet(sets._SetContainer, pyutilib.plugin.Plugin):
     18class _VirtualSet(sets._SetContainer, pyutilib.plugin.core.Plugin):
    1919    """
    2020    A set that does not contain elements, but instead overrides the
     
    2222    """
    2323
    24     pyutilib.plugin.implements(IPyomoSet)
     24    pyutilib.plugin.core.implements(IPyomoSet)
    2525
    2626    def __init__(self,*args,**kwds):
    2727        if "name" in kwds:
    28             pyutilib.plugin.Plugin.__init__(self,name=kwds["name"])
     28            pyutilib.plugin.core.Plugin.__init__(self,name=kwds["name"])
    2929        else:
    30             pyutilib.plugin.Plugin.__init__(self)
     30            pyutilib.plugin.core.Plugin.__init__(self)
    3131        self._class_override=False
    3232        sets._SetContainer.__init__(self,*args,**kwds)
  • trunk/coopr/pyomo/base/sets.py

    r1751 r1768  
    1111__all__ = ['Set', '_BaseSet', '_SetContainer', '_SetArray', '_ProductSet']
    1212
    13 import pyutilib.plugin
     13import pyutilib.plugin.core
    1414from coopr.pyomo.base.plugin import ComponentRegistration
    15 import pyutilib
     15import pyutilib.misc
    1616import sys
    1717import types
    1818import copy
    1919
    20 log = pyutilib.plugin.PluginGlobals.env().log
     20log = pyutilib.plugin.core.PluginGlobals.env().log
    2121
    2222##------------------------------------------------------------------------
     
    299299           raise TypeError, "Cannot add elements to virtual set `"+self.name+"'"
    300300        for val in args:
    301           tmp = pyutilib.flatten_tuple(val)
     301          tmp = pyutilib.misc.flatten_tuple(val)
    302302          self._verify(tmp)
    303303          try:
     
    795795    def __iter__(self):
    796796        """Returns an iterator/generator for the cross-product"""
    797         return pyutilib.flattened_cross_iter(*self.set_tuple)
     797        return pyutilib.misc.flattened_cross_iter(*self.set_tuple)
    798798
    799799    def __len__(self):
     
    862862                 self.add(self.initialize)
    863863           else:
    864               for val in pyutilib.cross(self.set_tuple):
     864              for val in pyutilib.misc.cross(self.set_tuple):
    865865                self.add(val)
    866866        #
  • trunk/coopr/pyomo/base/var.py

    r1531 r1768  
    1616from set_types import *
    1717from sets import _BaseSet
    18 import pyutilib
    19 from pyutilib.tpl.enum import Enum
     18import pyutilib.math
     19import pyutilib.misc
     20from pyutilib.enum import Enum
    2021import sys
    2122
     
    296297           for key in self._varval:
    297298             if self._varval[key].lb is not None and \
    298                 not pyutilib.is_finite(self._varval[key].lb):
     299                not pyutilib.math.is_finite(self._varval[key].lb):
    299300                self._varval[key].lb = None
    300301             if self._varval[key].ub is not None and \
    301                 not pyutilib.is_finite(self._varval[key].ub):
     302                not pyutilib.math.is_finite(self._varval[key].ub):
    302303                self._varval[key].ub = None
    303304        #
     
    350351        print >>ostream, "Domain="+self.domain.name
    351352        if None in self._varval:
    352            print >>ostream, prefix+"  Value="+pyutilib.format_io(self._varval[None].value)
     353           print >>ostream, prefix+"  Value="+pyutilib.misc.format_io(self._varval[None].value)
    353354        else:
    354355           for key in self._varval:
  • trunk/coopr/pyomo/main_script.py

    r1671 r1768  
    1919from coopr.opt.base import SolverFactory
    2020from coopr.opt.parallel import SolverManagerFactory
    21 import pyutilib
     21import pyutilib.services
     22import pyutilib.misc
    2223import textwrap
    2324import traceback
     
    189190        print "----------------------------------------------------------------"
    190191        components = pyomo.model_components()
    191         index = pyutilib.sort_index(components)
     192        index = pyutilib.misc.sort_index(components)
    192193        for i in index:
    193194            print ""
     
    200201        print "----------------------------------------------------------------"
    201202        pyomo_sets = pyomo.predefined_sets()
    202         index = pyutilib.sort_index(pyomo_sets)
     203        index = pyutilib.misc.sort_index(pyomo_sets)
    203204        for i in index:
    204205            print ""
     
    218219         pyomo.set_debugging( val )
    219220    if not options.logfile is None:
    220         pyutilib.setup_redirect(options.logfile)
     221        pyutilib.misc.setup_redirect(options.logfile)
    221222    if not options.tempdir is None:
    222223        if not os.path.exists(options.tempdir):
    223224            raise ValueError, "Directory for temporary files does not exist: "+options.tempdir
    224         pyutilib.TempfileManager.tempdir = options.tempdir
     225        pyutilib.services.TempfileManager.tempdir = options.tempdir
    225226
    226227    filter_excepthook=True
     
    253254    #
    254255    for file in options.preprocess:
    255         preprocess = pyutilib.import_file(file)
     256        preprocess = pyutilib.misc.import_file(file)
    256257       
    257258    #
     
    271272    # Create Model
    272273    #
    273     usermodel = pyutilib.import_file(args[0])
     274    usermodel = pyutilib.misc.import_file(args[0])
    274275    filter_excepthook=False
    275276    if "model" not in dir(usermodel):
     
    289290          instance = usermodel.model.create(args[1])
    290291       elif suffix == "py":
    291           userdata = pyutilib.import_file(args[1])
     292          userdata = pyutilib.misc.import_file(args[1])
    292293          if "modeldata" not in dir(userdata):
    293294             print ""
     
    365366
    366367    for file in options.postprocess:
    367         postprocess = pyutilib.import_file(file)
     368        postprocess = pyutilib.misc.import_file(file)
    368369        if "postprocess" in dir(postprocess):
    369370            postprocess.postprocess(instance,results)
     
    397398    #
    398399    if options.profile > 0:
    399         tfile = pyutilib.TempfileManager.create_tempfile(suffix=".profile")
     400        tfile = pyutilib.services.TempfileManager.create_tempfile(suffix=".profile")
    400401        tmp = cProfile.runctx('run_pyomo(options,args)',globals(),locals(),tfile)
    401402        p = pstats.Stats(tfile).strip_dirs()
     
    413414        p.print_callers(options.profile)
    414415        p.print_callees(options.profile)
    415         pyutilib.TempfileManager.clear_tempfiles()
     416        pyutilib.services.TempfileManager.clear_tempfiles()
    416417        ans = [tmp, None]
    417418    else:
  • trunk/coopr/pyomo/presolve/collect_linear_terms.py

    r1750 r1768  
    1010
    1111
    12 import pyutilib.plugin
     12import pyutilib.plugin.core
    1313from coopr.pyomo.base import expr, _VarBase, Constraint, Objective
    1414from coopr.pyomo.base.numvalue import NumericConstant
     
    2020
    2121
    22 class CollectLinearTerms(pyutilib.plugin.SingletonPlugin):
     22class CollectLinearTerms(pyutilib.plugin.core.SingletonPlugin):
    2323    """
    2424    This plugin processes a Pyomo Model instance to collect
     
    2626    """
    2727
    28     pyutilib.plugin.implements(IPyomoPresolveAction)
     28    pyutilib.plugin.core.implements(IPyomoPresolveAction)
    2929
    3030    def __init__(self, **kwds):
    3131        kwds['name'] = "collect_linear_terms"
    32         pyutilib.plugin.Plugin.__init__(self, **kwds)
     32        pyutilib.plugin.core.Plugin.__init__(self, **kwds)
    3333
    3434    def rank(self):
  • trunk/coopr/pyomo/presolve/generic_varlabels.py

    r1675 r1768  
    1010
    1111from coopr.pyomo.base import IPyomoPresolver, IPyomoPresolveAction, _VarBase
    12 import pyutilib.plugin
     12import pyutilib.plugin.core
    1313
    1414ignore = set(['"', ' ', "'", '`'])
     
    1616underscore = set(['-'])
    1717
    18 class GenericVarLabelsPresolver(pyutilib.plugin.SingletonPlugin):
     18class GenericVarLabelsPresolver(pyutilib.plugin.core.SingletonPlugin):
    1919    """
    2020    This plugin changes variables names to generate a label that
     
    2222    """
    2323
    24     pyutilib.plugin.implements(IPyomoPresolveAction)
     24    pyutilib.plugin.core.implements(IPyomoPresolveAction)
    2525
    2626    def __init__(self, **kwds):
    2727        kwds['name'] = "generic_varlabels"
    28         pyutilib.plugin.Plugin.__init__(self, **kwds)
     28        pyutilib.plugin.core.Plugin.__init__(self, **kwds)
    2929
    3030    def rank(self):
  • trunk/coopr/pyomo/presolve/identify_vars.py

    r1670 r1768  
    1010
    1111
    12 import pyutilib.plugin
     12import pyutilib.plugin.core
    1313from coopr.pyomo.base import expr, _VarBase, Constraint, Objective
    1414from coopr.pyomo.base.var import _VarValue, VarStatus
     
    1717
    1818
    19 class IdentifyVariablesPresolver(pyutilib.plugin.SingletonPlugin):
     19class IdentifyVariablesPresolver(pyutilib.plugin.core.SingletonPlugin):
    2020    """
    2121    This plugin processes a Pyomo Model instance to define
     
    2323    """
    2424
    25     pyutilib.plugin.implements(IPyomoPresolveAction)
     25    pyutilib.plugin.core.implements(IPyomoPresolveAction)
    2626
    2727    def __init__(self, **kwds):
    2828        kwds['name'] = "identify_variables"
    29         pyutilib.plugin.Plugin.__init__(self, **kwds)
     29        pyutilib.plugin.core.Plugin.__init__(self, **kwds)
    3030
    3131    def rank(self):
  • trunk/coopr/pyomo/presolve/numeric_varlabels.py

    r1290 r1768  
    99#  _________________________________________________________________________
    1010
    11 import pyutilib.plugin
     11import pyutilib.plugin.core
    1212from coopr.pyomo.base import IPyomoPresolver, IPyomoPresolveAction
    1313
    1414
    15 class NumericVarLabelsPresolver(pyutilib.plugin.SingletonPlugin):
     15class NumericVarLabelsPresolver(pyutilib.plugin.core.SingletonPlugin):
    1616    """
    1717    This plugin changes variables names to use a simple name that
     
    1919    """
    2020
    21     pyutilib.plugin.implements(IPyomoPresolveAction)
     21    pyutilib.plugin.core.implements(IPyomoPresolveAction)
    2222
    2323    def __init__(self, **kwds):
    2424        kwds['name'] = "numeric_varlabels"
    25         pyutilib.plugin.Plugin.__init__(self, **kwds)
     25        pyutilib.plugin.core.Plugin.__init__(self, **kwds)
    2626
    2727    def rank(self):
  • trunk/coopr/pyomo/presolve/simple_presolver.py

    r1290 r1768  
    99#  _________________________________________________________________________
    1010
    11 import pyutilib
    12 import pyutilib.plugin
     11import pyutilib.misc
     12import pyutilib.plugin.core
    1313from coopr.pyomo.base import IPyomoPresolver, IPyomoPresolveAction
    1414
    1515
    16 class SimplePresolver(pyutilib.plugin.SingletonPlugin):
     16class SimplePresolver(pyutilib.plugin.core.SingletonPlugin):
    1717    """
    1818    This plugin simply applies presolve actions in a fixed order
     
    2020    """
    2121
    22     pyutilib.plugin.implements(IPyomoPresolver)
     22    pyutilib.plugin.core.implements(IPyomoPresolver)
    2323
    2424    def __init__(self, **kwds):
    2525        kwds['name'] = "simple_presolver"
    26         pyutilib.plugin.Plugin.__init__(self, **kwds)
    27         self.actions = pyutilib.plugin.ExtensionPoint(IPyomoPresolveAction)
     26        pyutilib.plugin.core.Plugin.__init__(self, **kwds)
     27        self.actions = pyutilib.plugin.core.ExtensionPoint(IPyomoPresolveAction)
    2828        self.active_actions = set()
    2929        self.action_rank = {}
     
    7575        for item in actions:
    7676            ranks.append(self.action_rank[item])
    77         index = pyutilib.sort_index(ranks)
     77        index = pyutilib.misc.sort_index(ranks)
    7878        sorted=[]
    7979        for i in index:
  • trunk/coopr/pysp/__init__.py

    r1761 r1768  
    99#  _________________________________________________________________________
    1010
    11 import pyutilib.plugin
     11import pyutilib.plugin.core
    1212
    13 pyutilib.plugin.PluginGlobals.push_env( "coopr.pysp" )
     13pyutilib.plugin.core.PluginGlobals.push_env( "coopr.pysp" )
    1414
    1515from scenariotree import *
     
    2222from ph_script import *
    2323
    24 pyutilib.plugin.PluginGlobals.pop_env()
     24pyutilib.plugin.core.PluginGlobals.pop_env()
    2525
    2626
  • trunk/coopr/pysp/asynchph.py

    r1659 r1768  
    1010
    1111import sys
    12 import pyutilib
     12import pyutilib.plugin.core
    1313import types
    1414from coopr.pyomo import *
  • trunk/coopr/pysp/convergence.py

    r1730 r1768  
    1010
    1111import sys
    12 import pyutilib
    1312import types
    1413from coopr.pyomo import *
  • trunk/coopr/pysp/ef.py

    r1753 r1768  
     1import pyutilib
    12import sys
    23import os
     
    7071   #
    7172   reference_model_filename = model_directory+os.sep+"ReferenceModel.py"   
    72    modelimport = pyutilib.import_file(reference_model_filename)
     73   modelimport = pyutilib.misc.import_file(reference_model_filename)
    7374   filter_excepthook=False
    7475   if "model" not in dir(modelimport):
     
    9091   #
    9192
    92    treeimport = pyutilib.import_file(model_directory+os.sep+"ScenarioStructure.py")
     93   treeimport = pyutilib.misc.import_file(model_directory+os.sep+"ScenarioStructure.py")
    9394
    9495   tree_data = treeimport.model.create(instance_directory+os.sep+"ScenarioStructure.dat")
  • trunk/coopr/pysp/ef_writer_script.py

    r1753 r1768  
    1414from optparse import OptionParser
    1515
    16 import pyutilib
     16import pyutilib.services
    1717import textwrap
    1818import traceback
     
    8585        # Call the main ef writer with profiling.
    8686        #
    87         tfile = pyutilib.TempfileManager.create_tempfile(suffix=".profile")
     87        tfile = pyutilib.services.TempfileManager.create_tempfile(suffix=".profile")
    8888        tmp = cProfile.runctx('run_ef_writer(options,args)',globals(),locals(),tfile)
    8989        p = pstats.Stats(tfile).strip_dirs()
     
    101101        p.print_callers(options.profile)
    102102        p.print_callees(options.profile)
    103         pyutilib.TempfileManager.clear_tempfiles()
     103        pyutilib.services.TempfileManager.clear_tempfiles()
    104104        ans = [tmp, None]
    105105    else:
  • trunk/coopr/pysp/ph.py

    r1766 r1768  
    1010
    1111import sys
    12 import pyutilib
    1312import types
    1413from coopr.pyomo import *
  • trunk/coopr/pysp/ph_script.py

    r1758 r1768  
    1414from optparse import OptionParser
    1515
    16 import pyutilib
     16import pyutilib.services
     17import pyutilib.misc
    1718import textwrap
    1819import traceback
     
    232233         if options.verbose is True:
    233234            print "Scenario reference model filename="+reference_model_filename
    234          model_import = pyutilib.import_file(reference_model_filename)
     235         model_import = pyutilib.misc.import_file(reference_model_filename)
    235236         if "model" not in dir(model_import):
    236237            print ""
     
    276277         if options.verbose is True:
    277278            print "Scenario reference model filename="+reference_model_filename
    278          model_import = pyutilib.import_file(reference_model_filename)
     279         model_import = pyutilib.misc.import_file(reference_model_filename)
    279280         if "model" not in dir(model_import):
    280281            print ""
     
    312313         if options.verbose is True:
    313314            print "Scenario tree model filename="+scenario_tree_model_filename
    314          scenario_tree_import = pyutilib.import_file(scenario_tree_model_filename)
     315         scenario_tree_import = pyutilib.misc.import_file(scenario_tree_model_filename)
    315316         scenario_tree_model = scenario_tree_import.model
    316317      except IOError:
     
    490491        # Call the main PH routine with profiling.
    491492        #
    492         tfile = pyutilib.TempfileManager.create_tempfile(suffix=".profile")
     493        tfile = pyutilib.services.TempfileManager.create_tempfile(suffix=".profile")
    493494        tmp = cProfile.runctx('run_ph(options,args)',globals(),locals(),tfile)
    494495        p = pstats.Stats(tfile).strip_dirs()
     
    506507        p.print_callers(options.profile)
    507508        p.print_callees(options.profile)
    508         pyutilib.TempfileManager.clear_tempfiles()
     509        pyutilib.services.TempfileManager.clear_tempfiles()
    509510        ans = [tmp, None]
    510511    else:
  • trunk/coopr/pysp/phextension.py

    r1532 r1768  
    1111__all__ = ['IPHExtension']
    1212
    13 from pyutilib.plugin import *
     13from pyutilib.plugin.core import *
    1414
    1515class IPHExtension(Interface):
  • trunk/coopr/pysp/scenariotree.py

    r1607 r1768  
    1010
    1111import sys
    12 import pyutilib
    1312import types
    1413from coopr.pyomo import *
  • trunk/coopr/pysp/wwphextension.py

    r1748 r1768  
    1010
    1111import types
    12 from pyutilib.plugin import *
     12from pyutilib.plugin.core import *
    1313from coopr.pysp import phextension
    1414from coopr.pysp.phutils import *
  • trunk/coopr/sucasa/ampl_parser.py

    r1217 r1768  
    2222import ply.yacc as yacc
    2323from ampl_info import AmplInfo
    24 from pyutilib import flatten
     24from pyutilib.misc import flatten
    2525from pyutilib.ply import t_newline, t_ignore, _find_column, p_error, ply_init
    2626
  • trunk/coopr/sucasa/main_script.py

    r1515 r1768  
    2222import sucasa_PICO
    2323import run_ampl
    24 import pyutilib
     24import pyutilib.subprocess
    2525import re
    2626
     
    266266        print "  . PICO Command: "+cmd
    267267        print "  . Running PICO ...",
    268         pyutilib.run_command(cmd,"PICO.out")
     268        pyutilib.subprocess.run(cmd,"PICO.out")
    269269        print "done."
    270270        if options.quiet:
  • trunk/coopr/sucasa/mapfile_parser.py

    r1217 r1768  
    1616import ply.lex as lex
    1717import ply.yacc as yacc
    18 from pyutilib import flatten
     18from pyutilib.misc import flatten
    1919from pyutilib.ply import t_newline, t_ignore, t_COMMENT, _find_column, p_error, ply_init
    2020
  • trunk/coopr/sucasa/run_ampl.py

    r1217 r1768  
    1212import os
    1313from string import Template
    14 import pyutilib
     14import pyutilib.subprocess
    1515
    1616
     
    8080    #
    8181    print "  . Running AMPL ...",
    82     pyutilib.run_command("ampl ampl_script.in",app_label+".val")
     82    pyutilib.subprocess.run("ampl ampl_script.in",app_label+".val")
    8383    print "done."
    8484    #
  • 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):
  • trunk/test/plugins/mip/test_cbc.py

    r1657 r1768  
    1111currdir = dirname(abspath(__file__))+os.sep
    1212
    13 import pyutilib_th
    14 import pyutilib
     13import pyutilib.th
     14import pyutilib.common
     15import pyutilib.services
    1516import unittest
    1617from nose.tools import nottest
     
    2425    cbc = coopr.plugins.mip.CBC(keepFiles=True)
    2526    cbc_available= (not cbc.executable() is None)
    26 except pyutilib.ApplicationError:
     27except pyutilib.common.ApplicationError:
    2728    cbc_available=False
    2829    pass
    2930
    3031
    31 class mock_all(pyutilib_th.TestCase):
     32class mock_all(pyutilib.th.TestCase):
    3233
    3334    def setUp(self):
     
    3839        tmpdir = os.getcwd()
    3940        os.chdir(currdir)
    40         pyutilib.TempfileManager.tempdir = currdir
     41        pyutilib.services.TempfileManager.tempdir = currdir
    4142        if flag:
    4243            self.cbc = coopr.plugins.mip.CBC(keepFiles=True)
     
    4647    def tearDown(self):
    4748        global tmpdir
    48         pyutilib.TempfileManager.clear_tempfiles()
     49        pyutilib.services.TempfileManager.clear_tempfiles()
    4950        os.chdir(tmpdir)
    5051
  • trunk/test/plugins/mip/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.common
     22import pyutilib.plugin.core
     23import pyutilib.plugin.config
    2124import xml
    2225import filecmp
     
    6669
    6770
    68 class OptConvertDebug(pyutilib_th.TestCase):
     71class Test(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
     
    9396        try:
    9497           ans = coopr.opt.convert_problem( (currdir+"test4.nl",), None, [ProblemFormat.cpxlp])
    95         except pyutilib.ApplicationError:
    96            if not pyutilib.registered_executable("pico_convert") is None:
    97               self.fail("Unexpected ApplicationError - pico_convert is enabled but not available")
    98            return
    99         except ConverterError:
    100            if not pyutilib.registered_executable("pico_convert") is None:
    101               self.fail("Unexpected ConverterError - pico_convert is enabled but not available")
     98        except pyutilib.common.ApplicationError, err:
     99           if not pyutilib.services.registered_executable("pico_convert") is None:
     100              self.fail("Unexpected ApplicationError - pico_convert is enabled but not available: '%s'" % str(err))
     101           return
     102        except ConverterError, err:
     103           if not pyutilib.services.registered_executable("pico_convert") is None:
     104              self.fail("Unexpected ConverterError - pico_convert is enabled but not available: '%s'" % str(err))
    102105           return
    103106        self.failUnlessEqual(ans[0][0][-15:],"pico_convert.lp")
     
    108111        try:
    109112           ans = coopr.opt.convert_problem( (currdir+"test3.mod",), None, [ProblemFormat.cpxlp])
    110         except pyutilib.ApplicationError:
    111            if not pyutilib.registered_executable("glpsol") is None:
    112               self.fail("Unexpected ApplicationError - glpsol is enabled but not available")
    113            return
    114         except ConverterError:
    115            if not pyutilib.registered_executable("glpsol") is None:
    116               self.fail("Unexpected ConverterError - glpsol is enabled but not available")
     113        except pyutilib.common.ApplicationError, err:
     114           if not pyutilib.services.registered_executable("glpsol") is None:
     115              self.fail("Unexpected ApplicationError - glpsol is enabled but not available: '%s'" % str(err))
     116           return
     117        except ConverterError, err:
     118           if not pyutilib.services.registered_executable("glpsol") is None:
     119              self.fail("Unexpected ConverterError - glpsol is enabled but not available: '%s'" % str(err))
    117120           return
    118121        self.failUnlessEqual(ans[0],("glpsol.lp",))
     
    123126        try:
    124127           ans = coopr.opt.convert_problem( (currdir+"test5.mod",currdir+"test5.dat"), None, [ProblemFormat.cpxlp])
    125         except pyutilib.ApplicationError:
    126            if not pyutilib.registered_executable("glpsol") is None:
    127               self.fail("Unexpected ApplicationError - glpsol is enabled but not available")
    128            return
    129         except ConverterError:
    130            if not pyutilib.registered_executable("glpsol") is None:
    131               self.fail("Unexpected ConverterError - glpsol is enabled but not available")
     128        except pyutilib.common.ApplicationError, err:
     129           if not pyutilib.services.registered_executable("glpsol") is None:
     130              self.fail("Unexpected ApplicationError - glpsol is enabled but not available: '%s'" % str(err))
     131           return
     132        except ConverterError, err:
     133           if not pyutilib.services.registered_executable("glpsol") is None:
     134              self.fail("Unexpected ConverterError - glpsol is enabled but not available: '%s'" % str(err))
    132135           return
    133136        self.failUnlessEqual(ans[0],("glpsol.lp",))
     
    145148        try:
    146149           ans = coopr.opt.convert_problem( (arg,), None, [ProblemFormat.cpxlp])
    147         except ConverterError:
    148            if pyutilib.registered_executable("pico_convert") is None:
     150        except ConverterError, err:
     151           if pyutilib.services.registered_executable("pico_convert") is None:
    149152              return
    150153           else:
    151               self.fail("Expected ApplicationError because pico_convert is not available")
     154              self.fail("Expected ApplicationError because pico_convert is not available: '%s'" % str(err))
    152155        self.failUnlessEqual(ans[0][0][-15:],"pico_convert.lp")
    153156        os.remove(ans[0][0])
     
    158161        try:
    159162           ans = coopr.opt.convert_problem( (arg,ProblemFormat.mps,arg), None, [ProblemFormat.mps])
    160         except ConverterError:
    161            if pyutilib.registered_executable("pico_convert") is None:
     163        except ConverterError, err:
     164           if pyutilib.services.registered_executable("pico_convert") is None:
    162165                return
    163166           else:
    164                 self.fail("Expected ApplicationError because pico_convert is not available")
     167                self.fail("Expected ApplicationError because pico_convert is not available: '%s'" % str(err))
    165168        self.failUnlessEqual(ans[0][0][-16:],"pico_convert.mps")
    166169        os.remove(ans[0][0])
     
    178181          coopr.opt.convert_problem( ("test4.nl","tmp.nl"), ProblemFormat.nl, [])
    179182          self.fail("Expected ConverterError exception")
    180         except ConverterError:
     183        except ConverterError, err:
    181184          pass
    182185
     
    226229          ans = coopr.opt.convert_problem( (currdir+"unknown.nl",), None, [ProblemFormat.cpxlp])
    227230          self.fail("Expected ConverterError exception")
    228         except pyutilib.ApplicationError:
    229            if pyutilib.registered_executable("pico_convert").enabled():
    230               self.fail("Expected ApplicationError because pico_convert is not available")
     231        except pyutilib.common.ApplicationError, err:
     232           if pyutilib.services.registered_executable("pico_convert").enabled():
     233              self.fail("Expected ApplicationError because pico_convert is not available: '%s'" % str(err))
    231234           return
    232235        except ConverterError:
     
    235238    def test_error9(self):
    236239        """ The Opt configuration has not been initialized """
    237         cmd = pyutilib.registered_executable("pico_convert")
     240        cmd = pyutilib.services.registered_executable("pico_convert")
    238241        if not cmd is None:
    239242            cmd.disable()
     
    260263          ans = coopr.opt.convert_problem( (currdir+"test3.mod",currdir+"test5.dat"), None, [ProblemFormat.cpxlp])
    261264          self.fail("Expected ConverterError exception because we provided a MOD file with a 'data;' declaration")
    262         except pyutilib.ApplicationError:
    263            if pyutilib.registered_executable("glpsol").enabled():
    264               self.fail("Expected ApplicationError because glpsol is not available")
     265        except pyutilib.common.ApplicationError, err:
     266           if pyutilib.services.registered_executable("glpsol").enabled():
     267              self.fail("Expected ApplicationError because glpsol is not available: '%s'" % str(err))
    265268           return
    266269        except ConverterError:
  • trunk/test/plugins/mip/test_cplex.py

    r1663 r1768  
    1313import unittest
    1414from nose.tools import nottest
    15 import pyutilib_th
    16 import pyutilib
     15import pyutilib.th
     16import pyutilib.services
     17import pyutilib.common
    1718import coopr.plugins.mip
    1819import coopr.opt
     
    2425    cplex = coopr.plugins.mip.CPLEX(keepFiles=True)
    2526    cplex_available= (not cplex.executable() is None) and cplex.available(False)
    26 except pyutilib.ApplicationError:
     27except pyutilib.common.ApplicationError:
    2728    cplex_available=False
    2829try:
    29     pico_convert =  pyutilib.registered_executable("pico_convert")
     30    pico_convert =  pyutilib.services.registered_executable("pico_convert")
    3031    pico_convert_available= (not pico_convert is None)
    31 except pyutilib.ApplicationError:
     32except pyutilib.common.ApplicationError:
    3233    pico_convert_available=False
    3334
    3435
    35 class mock_all(pyutilib_th.TestCase):
     36class mock_all(pyutilib.th.TestCase):
    3637
    3738    def setUp(self):
     
    4243        tmpdir = os.getcwd()
    4344        os.chdir(currdir)
    44         pyutilib.TempfileManager.sequential_files(0)
    45         pyutilib.TempfileManager.tempdir = currdir
     45        pyutilib.services.TempfileManager.sequential_files(0)
     46        pyutilib.services.TempfileManager.tempdir = currdir
    4647        if flag:
    4748            self.cplex = coopr.plugins.mip.CPLEX(keepFiles=True)
     
    5152    def tearDown(self):
    5253        global tmpdir
    53         pyutilib.TempfileManager.clear_tempfiles()
     54        pyutilib.services.TempfileManager.clear_tempfiles()
    5455        os.chdir(tmpdir)
    55         pyutilib.TempfileManager.unique_files()
     56        pyutilib.services.TempfileManager.unique_files()
    5657
    5758    def test_path(self):
  • trunk/test/plugins/mip/test_factory.py

    r1657 r1768  
    1616import coopr.plugins.mip
    1717import coopr
    18 import pyutilib
     18import pyutilib.services
     19import pyutilib.plugin.core
    1920
    2021
     
    5455
    5556    def setUp(self):
    56         pyutilib.TempfileManager.tempdir = currdir
     57        pyutilib.services.TempfileManager.tempdir = currdir
    5758
    5859    def tearDown(self):
    59         pyutilib.TempfileManager.clear_tempfiles()
     60        pyutilib.services.TempfileManager.clear_tempfiles()
    6061
    6162    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("_mock_pico")
    8990        self.failUnlessEqual(service.type(), "_mock_pico")
     
    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/plugins/mip/test_glpk.py

    r1657 r1768  
    1111currdir = dirname(abspath(__file__))+os.sep
    1212
    13 import pyutilib_th
    14 import pyutilib
     13import pyutilib.th
     14import pyutilib.common
     15import pyutilib.services
    1516import unittest
    1617from nose.tools import nottest
     
    2728    glpk_available=False
    2829    pass
    29 except pyutilib.ApplicationError:
     30except pyutilib.common.ApplicationError:
    3031    glpk_available=False
    3132    pass
    3233
    3334
    34 class mock_all(pyutilib_th.TestCase):
     35class mock_all(pyutilib.th.TestCase):
    3536
    3637    def setUp(self):
    3738        self.do_setup(False)
    38         pyutilib.TempfileManager.tempdir = currdir
     39        pyutilib.services.TempfileManager.tempdir = currdir
    3940
    4041    def do_setup(self,flag):
     
    4748        if os.path.exists(currdir+"glpk.soln"):
    4849           os.remove(currdir+"glpk.soln")
    49         pyutilib.TempfileManager.clear_tempfiles()
     50        pyutilib.services.TempfileManager.clear_tempfiles()
    5051
    5152    def test_path(self):
  • trunk/test/plugins/mip/test_pico.py

    r1663 r1768  
    1313import unittest
    1414from nose.tools import nottest
    15 import pyutilib_th
    16 import pyutilib
     15import pyutilib.th
     16import pyutilib.common
     17import pyutilib.services
    1718import coopr.plugins.mip
    1819import coopr.opt
     
    2223
    2324try:
    24     pico_convert =  pyutilib.registered_executable("pico_convert")
     25    pico_convert =  pyutilib.services.registered_executable("pico_convert")
    2526    pico_convert_available= (not pico_convert is None)
    26 except pyutilib.ApplicationError:
     27except pyutilib.common.ApplicationError:
    2728    pico_convert_available=False
    2829
     
    3031    pico = coopr.plugins.mip.PICO(keepFiles=True)
    3132    pico_available= (not pico.executable() is None)
    32 except pyutilib.ApplicationError:
     33except pyutilib.common.ApplicationError:
    3334    pico_available=False
    3435    pass
    3536
    3637
    37 class mock_all(pyutilib_th.TestCase):
     38class mock_all(pyutilib.th.TestCase):
    3839
    3940    def setUp(self):
     
    4445        tmpdir = os.getcwd()
    4546        os.chdir(currdir)
    46         pyutilib.TempfileManager.tempdir = currdir
     47        pyutilib.services.TempfileManager.tempdir = currdir
    4748        if flag:
    4849            self.pico = coopr.plugins.mip.PICO(keepFiles=True)
     
    5253    def tearDown(self):
    5354        global tmpdir
    54         pyutilib.TempfileManager.clear_tempfiles()
     55        pyutilib.services.TempfileManager.clear_tempfiles()
    5556        os.chdir(tmpdir)
    5657
  • trunk/test/plugins/mip/test_solver.py

    r1657 r1768  
    1616import coopr.opt
    1717import coopr
    18 import pyutilib
     18import pyutilib.services
     19import pyutilib.common
    1920
    2021
     
    3738
    3839    def setUp(self):
    39         pyutilib.TempfileManager.tempdir = currdir
     40        pyutilib.services.TempfileManager.tempdir = currdir
    4041
    4142    def tearDown(self):
    42         pyutilib.TempfileManager.clear_tempfiles()
     43        pyutilib.services.TempfileManager.clear_tempfiles()
    4344
    4445
     
    7576            ans.available()
    7677            self.fail("Expected exception for 'stest' solver, which is disabled")
    77         except pyutilib.ApplicationError:
     78        except pyutilib.common.ApplicationError:
    7879            pass
    7980
  • trunk/test/pyomo/examples/test_amplbook2.py

    r1101 r1768  
    1212
    1313from coopr.pyomo import *
    14 import pyutilib
    15 import pyutilib_th
     14import pyutilib.th
    1615import glob
    1716
    18 class TestAmplbook2(pyutilib_th.TestCase): pass
     17class TestAmplbook2(pyutilib.th.TestCase): pass
    1918
    2019#
  • trunk/test/pyomo/examples/test_tutorials.py

    r1101 r1768  
    1313
    1414from coopr.pyomo import *
    15 import pyutilib
    16 import pyutilib_th
     15import pyutilib.misc
     16import pyutilib.th
    1717
    1818try:
     
    2222  _win32com=False #pragma:nocover
    2323
    24 class PyomoTutorials(pyutilib_th.TestCase):
     24class PyomoTutorials(pyutilib.th.TestCase):
    2525
    2626    def setUp(self):
     
    3131
    3232    def test_data(self):
    33         pyutilib.run_file(tutorial_dir+"data.py", logfile=currdir+"data.log", execdir=tutorial_dir)
     33        pyutilib.misc.run_file(tutorial_dir+"data.py", logfile=currdir+"data.log", execdir=tutorial_dir)
    3434        self.failUnlessFileEqualsBaseline(currdir+"data.log", tutorial_dir+"data.out")
    3535
     
    3737        if not _win32com:
    3838           return
    39         pyutilib.run_file(tutorial_dir+"excel.py", logfile=currdir+"excel.log", execdir=tutorial_dir)
     39        pyutilib.misc.run_file(tutorial_dir+"excel.py", logfile=currdir+"excel.log", execdir=tutorial_dir)
    4040        self.failUnlessFileEqualsBaseline(currdir+"excel.log", tutorial_dir+"excel.out")
    4141
    4242    def test_set(self):
    43         pyutilib.run_file(tutorial_dir+"set.py", logfile=currdir+"set.log", execdir=tutorial_dir)
     43        pyutilib.misc.run_file(tutorial_dir+"set.py", logfile=currdir+"set.log", execdir=tutorial_dir)
    4444        self.failUnlessFileEqualsBaseline(currdir+"set.log", tutorial_dir+"set.out")
    4545
    4646    def test_table(self):
    47         pyutilib.run_file(tutorial_dir+"table.py", logfile=currdir+"table.log", execdir=tutorial_dir)
     47        pyutilib.misc.run_file(tutorial_dir+"table.py", logfile=currdir+"table.log", execdir=tutorial_dir)
    4848        self.failUnlessFileEqualsBaseline(currdir+"table.log", tutorial_dir+"table.out")
    4949
    5050    def test_param(self):
    51         pyutilib.run_file(tutorial_dir+"param.py", logfile=currdir+"param.log", execdir=tutorial_dir)
     51        pyutilib.misc.run_file(tutorial_dir+"param.py", logfile=currdir+"param.log", execdir=tutorial_dir)
    5252        self.failUnlessFileEqualsBaseline(currdir+"param.log", tutorial_dir+"param.out")
    5353
  • trunk/test/pyomo/unit/test_expr.py

    r1438 r1768  
    1313currdir = dirname(abspath(__file__))+os.sep
    1414
    15 import pyutilib_th
     15import pyutilib.th
    1616from coopr.pyomo import *
    1717from nose.tools import nottest
    1818
    19 class PyomoModel(pyutilib_th.TestCase):
     19class PyomoModel(pyutilib.th.TestCase):
    2020
    2121    def setUp(self):
     
    210210
    211211
    212 class TestNumericValue(pyutilib_th.TestCase):
     212class TestNumericValue(pyutilib.th.TestCase):
    213213
    214214    def test_vals(self):
     
    274274
    275275
    276 class MiscVarTests(pyutilib_th.TestCase):
     276class MiscVarTests(pyutilib.th.TestCase):
    277277
    278278    def test_error1(self):
     
    512512
    513513
    514 class MiscParamTests(pyutilib_th.TestCase):
     514class MiscParamTests(pyutilib.th.TestCase):
    515515
    516516    def test_constructor(self):
     
    613613
    614614
    615 class MiscExprTests(pyutilib_th.TestCase):
     615class MiscExprTests(pyutilib.th.TestCase):
    616616
    617617    def setUp(self):
     
    680680
    681681
    682 class MiscObjTests(pyutilib_th.TestCase):
     682class MiscObjTests(pyutilib.th.TestCase):
    683683
    684684    def test_constructor(self):
     
    750750       
    751751
    752 class MiscConTests(pyutilib_th.TestCase):
     752class MiscConTests(pyutilib.th.TestCase):
    753753
    754754    def test_constructor(self):
  • trunk/test/pyomo/unit/test_misc.py

    r1171 r1768  
    1111
    1212from coopr.pyomo import *
    13 import pyutilib_th
     13import pyutilib.th
    1414
    1515def rule1(model):
     
    1818    return (1,model.x+model.y[1]+i,2)
    1919
    20 class PyomoModel(pyutilib_th.TestCase):
     20class PyomoModel(pyutilib.th.TestCase):
    2121
    2222    def setUp(self):
  • trunk/test/pyomo/unit/test_model.py

    r1663 r1768  
    2222from coopr.opt import *
    2323from coopr.pyomo.base.var import _VarElement
    24 import pyutilib_th
    25 
    26 class PyomoModel(pyutilib_th.TestCase):
     24import pyutilib.th
     25import pyutilib.services
     26
     27class PyomoModel(pyutilib.th.TestCase):
    2728
    2829    def setUp(self):
     
    11371138        self.instance = self.model.create()
    11381139        #self.instance.pprint()
    1139         if not pyutilib.registered_executable("glpsol"):
     1140        if not pyutilib.services.registered_executable("glpsol"):
    11401141            return
    11411142        else:   
     
    11621163        self.instance = self.model.create()
    11631164        #self.instance.pprint()
    1164         if not pyutilib.registered_executable("glpsol"):
     1165        if not pyutilib.services.registered_executable("glpsol"):
    11651166            return
    11661167        else:   
     
    12051206        self.instance = self.model.create()
    12061207        #self.instance.pprint()
    1207         if not pyutilib.registered_executable("glpsol"):
     1208        if not pyutilib.services.registered_executable("glpsol"):
    12081209            return
    12091210        else:   
  • trunk/test/pyomo/unit/test_param.py

    r1448 r1768  
    1616sys.path.insert(0, dirname(dirname(abspath(__file__)))+"/../..")
    1717from coopr.pyomo import *
    18 import pyutilib
    1918
    2019class PyomoModel(unittest.TestCase):
  • trunk/test/pyomo/unit/test_preprocess.py

    r1675 r1768  
    1010currdir = dirname(abspath(__file__))+os.sep
    1111
    12 import pyutilib_th
     12import pyutilib.th
    1313from coopr.pyomo import *
    1414from nose.tools import nottest
    1515
    1616
    17 class TestPreprocess(pyutilib_th.TestCase):
     17class TestPreprocess(pyutilib.th.TestCase):
    1818
    1919    def test_label1(self):
  • trunk/test/pyomo/unit/test_util.py

    r1453 r1768  
    1010currdir = dirname(abspath(__file__))+os.sep
    1111
    12 import pyutilib_th
     12import pyutilib.th
    1313from coopr.pyomo import *
    1414from nose.tools import nottest
     
    1616
    1717
    18 class TestNumericValue(pyutilib_th.TestCase):
     18class TestNumericValue(pyutilib.th.TestCase):
    1919
    2020    def test_expr1(self):
     
    7575        self.failUnlessFileEqualsBaseline(currdir+"test_expr4.out",currdir+"test_expr4.txt")
    7676
    77 class TestPickle(pyutilib_th.TestCase):
     77class TestPickle(pyutilib.th.TestCase):
    7878
    7979    def test_p1(self):
  • trunk/test/pysp/unit/test_ph.py

    r1340 r1768  
    1212#
    1313import unittest
    14 import pyutilib
    15 import pyutilib_th
     14import pyutilib.misc
     15import pyutilib.th
    1616
    1717#
    18 # Define a testing class, using the pyutilib_th.TestCase class.  This is
     18# Define a testing class, using the pyutilib.th.TestCase class.  This is
    1919# an extension of the unittest.TestCase class that adds additional testing
    2020# functions.
    2121#
    22 class TestPH(pyutilib_th.TestCase):
     22class TestPH(pyutilib.th.TestCase):
    2323
    2424    #
     
    2727    #
    2828    def test_dummy(self):
    29         pyutilib.setup_redirect(currdir+"dummy.out")
     29        pyutilib.misc.setup_redirect(currdir+"dummy.out")
    3030        print "HELLO WORLD"
    31         pyutilib.reset_redirect()
     31        pyutilib.misc.reset_redirect()
    3232        self.failUnlessFileEqualsBaseline(currdir+"dummy.out",currdir+"dummy.txt")
    3333
  • trunk/test/sucasa/models/test_amplbook2.py

    r1023 r1768  
    1212
    1313from coopr.sucasa import parse_mapfile,MILPSymbInfo,parse_ampl
    14 import pyutilib
    15 import pyutilib_th
     14import pyutilib.misc
     15import pyutilib.th
    1616import glob
    1717
     
    1919# Test class
    2020#
    21 class TestAmplbook2(pyutilib_th.TestCase): pass
     21class TestAmplbook2(pyutilib.th.TestCase): pass
    2222#
    2323# The directory with the test data
     
    2929def create_map(name):
    3030    prefix=data_dir+name
    31     pyutilib.setup_redirect(prefix+".out")
     31    pyutilib.misc.setup_redirect(prefix+".out")
    3232    ans = parse_ampl(filename=data_dir+name+".mod")
    3333    sinfo = MILPSymbInfo()
     
    3535    ans.initialize(sinfo,quiet=True)
    3636    sinfo.write_mapfile(prefix+".out.map")
    37     pyutilib.reset_redirect()
     37    pyutilib.misc.reset_redirect()
    3838    return [prefix+".out.map",[prefix+".out"]]
    3939#
  • trunk/test/sucasa/unit/test_AmplInfo.py

    r1137 r1768  
    1111
    1212import unittest
    13 import pyutilib
    14 import pyutilib_th
     13import pyutilib.misc
     14import pyutilib.th
    1515from nose.tools import nottest
    1616from coopr.sucasa.ampl_info import AmplInfo
    1717from coopr.sucasa.symb_info import MILPSymbInfo
    1818
    19 class AmplInfoTester(pyutilib_th.TestCase):
     19class AmplInfoTester(pyutilib.th.TestCase):
    2020
    2121    def setUp(self):
     
    5555        sinfo = MILPSymbInfo()
    5656        self.info.initialize(sinfo,quiet=True)
    57         pyutilib.setup_redirect(currdir+"initialize1.out")
     57        pyutilib.misc.setup_redirect(currdir+"initialize1.out")
    5858        print str(sinfo)
    59         pyutilib.reset_redirect()
     59        pyutilib.misc.reset_redirect()
    6060        self.failUnlessFileEqualsBaseline(currdir+"initialize1.out",currdir+"initialize1.txt")
    6161
     
    7575        sinfo = MILPSymbInfo()
    7676        self.info.initialize(sinfo,quiet=True)
    77         pyutilib.setup_redirect(currdir+"initialize2.out")
     77        pyutilib.misc.setup_redirect(currdir+"initialize2.out")
    7878        print str(sinfo)
    79         pyutilib.reset_redirect()
     79        pyutilib.misc.reset_redirect()
    8080        self.failUnlessFileEqualsBaseline(currdir+"initialize2.out",currdir+"initialize2.txt")
    8181
     
    100100        sinfo = MILPSymbInfo()
    101101        self.info.initialize(sinfo,quiet=True)
    102         pyutilib.setup_redirect(currdir+"initialize3.out")
     102        pyutilib.misc.setup_redirect(currdir+"initialize3.out")
    103103        print str(sinfo)
    104         pyutilib.reset_redirect()
     104        pyutilib.misc.reset_redirect()
    105105        self.failUnlessFileEqualsBaseline(currdir+"initialize3.out",currdir+"initialize3.txt")
    106106
     
    121121        sinfo = MILPSymbInfo()
    122122        try:
    123             pyutilib.setup_redirect(currdir+"initialize_err1.out")
     123            pyutilib.misc.setup_redirect(currdir+"initialize_err1.out")
    124124            self.info.initialize(sinfo,quiet=True)
    125             pyutilib.reset_redirect()
     125            pyutilib.misc.reset_redirect()
    126126            self.fail("Expected IOError")
    127127        except IOError:
    128             pyutilib.reset_redirect()
     128            pyutilib.misc.reset_redirect()
    129129            os.remove(currdir+"initialize_err1.out")
    130130
     
    155155        sinfo.add_symbol('max','Xe')
    156156        sinfo.add_symbol('con','Xf')
    157         pyutilib.setup_redirect(currdir+"check.out")
     157        pyutilib.misc.setup_redirect(currdir+"check.out")
    158158        self.info.check(sinfo)
    159         pyutilib.reset_redirect()
     159        pyutilib.misc.reset_redirect()
    160160        self.failUnlessFileEqualsBaseline(currdir+"check.out",currdir+"check.txt")
    161161       
  • trunk/test/sucasa/unit/test_parser.py

    r1137 r1768  
    1313from nose.tools import nottest
    1414from coopr.sucasa import parse_ampl,MILPSymbInfo
    15 import pyutilib
    16 import pyutilib_th
    17 
    18 class ParserTester(pyutilib_th.TestCase):
     15import pyutilib.misc
     16import pyutilib.th
     17
     18class ParserTester(pyutilib.th.TestCase):
    1919
    2020    def tearDown(self):
     
    234234    def test_data1(self):
    235235        """Parse data"""
    236         pyutilib.setup_redirect(currdir+"data1.out")
     236        pyutilib.misc.setup_redirect(currdir+"data1.out")
    237237        ans = parse_ampl("data;",debug=1)
    238         pyutilib.reset_redirect()
     238        pyutilib.misc.reset_redirect()
    239239        os.remove(currdir+"data1.out")
    240240        tmp=str(ans)
     
    247247        """Test parser with ampl1.mod"""
    248248        ans = parse_ampl(filename=currdir+"ampl1.mod")
    249         pyutilib.setup_redirect(currdir+"ampl1.out")
     249        pyutilib.misc.setup_redirect(currdir+"ampl1.out")
    250250        print str(ans)
    251         pyutilib.reset_redirect()
     251        pyutilib.misc.reset_redirect()
    252252        self.failUnlessFileEqualsBaseline(currdir+"ampl1.out",currdir+"ampl1.txt")
    253253       
  • trunk/test/sucasa/unit/test_symb_info.py

    r1011 r1768  
    1313from nose.tools import nottest
    1414from coopr.sucasa import parse_mapfile,MILPSymbInfo
    15 import pyutilib
    16 import pyutilib_th
     15import pyutilib.misc
     16import pyutilib.th
    1717
    18 class ParseMapFileTester(pyutilib_th.TestCase):
     18class ParseMapFileTester(pyutilib.th.TestCase):
    1919
    2020    def setUp(self):
     
    4242        """Parser sucasa1.map"""
    4343        ans = parse_mapfile(self.info, filename=currdir+"sucasa1.map")
    44         pyutilib.setup_redirect(currdir+"sucasa1.out")
     44        pyutilib.misc.setup_redirect(currdir+"sucasa1.out")
    4545        ans.print_symbols()
    46         pyutilib.reset_redirect()
     46        pyutilib.misc.reset_redirect()
    4747        self.failUnlessFileEqualsBaseline(currdir+"sucasa1.out",currdir+"sucasa1.txt")
    4848
     
    8989        """Parse duplicate declarations"""
    9090        try:
    91             pyutilib.setup_redirect(currdir+"error2.out")
     91            pyutilib.misc.setup_redirect(currdir+"error2.out")
    9292            ans = parse_mapfile(self.info,"set a within integers dimen 1;\nset a within integers dimen 1;")
    9393            self.fail("test_error2")
    9494        except IOError:
    9595            pass
    96         pyutilib.reset_redirect()
     96        pyutilib.misc.reset_redirect()
    9797        os.remove(currdir+"error2.out")
    9898
Note: See TracChangeset for help on using the changeset viewer.