source: trunk/test/core/base/test_config.py @ 1768

Last change on this file since 1768 was 1768, checked in by wehart, 11 years ago

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.

File size: 1.8 KB
Line 
1#
2# Unit Tests for coopr.opt.opt_config
3#
4#
5
6import os
7import sys
8from os.path import abspath, dirname
9sys.path.insert(0, dirname(dirname(abspath(__file__)))+"/../..")
10cooprdir = dirname(abspath(__file__))+os.sep+".."+os.sep+".."+os.sep
11currdir = dirname(abspath(__file__))+os.sep
12
13import unittest
14from nose.tools import nottest
15import coopr.opt
16import pyutilib.services
17import pyutilib.plugin.app
18import pyutilib.misc
19
20pyutilib.services.TempfileManager.tempdir = currdir
21
22class OptConfigDebug(unittest.TestCase):
23
24    def setUp(self):
25        pyutilib.services.TempfileManager.tempdir = currdir
26
27    def tearDown(self):
28        pyutilib.services.TempfileManager.clear_tempfiles()
29
30    def test_config1(self):
31        """
32        Read in config file opt1.cfg
33        """
34        app = pyutilib.plugin.app.SimpleApplication("testapp")
35        #pyutilib.plugin.PluginGlobals.pprint()
36        #app.config.summarize()
37        app.save_configuration(currdir+"opt1-out.cfg")
38        app.configure(currdir+"opt1.cfg")
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"))
47
48
49if __name__ == "__main__":
50   unittest.main()
Note: See TracBrowser for help on using the repository browser.