source: coopr.opt/trunk/coopr/opt/tests/base/test_sol.py @ 1918

Last change on this file since 1918 was 1918, checked in by wehart, 10 years ago

Rework of the SolverResults? object, to provide for a more explicit
definition of solver results, and to support loading of
solver results from YAML-formated data.

File size: 1.1 KB
Line 
1#
2# Unit Tests for coopr.opt.base.OS
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 coopr
17import xml
18import pyutilib.th
19import pyutilib.services
20
21
22class Test(pyutilib.th.TestCase):
23
24    def setUp(self):
25        pyutilib.services.TempfileManager.tempdir = currdir
26
27    def tearDown(self):
28        pyutilib.services.TempfileManager.clear_tempfiles()
29        if os.path.exists(currdir+"test_sol.txt"):
30           os.remove(currdir+"test_sol.txt")
31
32    def test_read_solution1(self):
33        reader = coopr.opt.reader.sol.ResultsReader_sol()
34
35    def test_factory(self):
36        reader = coopr.opt.ReaderFactory("sol")
37        soln = reader(currdir+"test4_sol.sol")
38        soln.write(filename=currdir+"factory.txt")
39        self.failUnlessFileEqualsBaseline(currdir+"factory.txt", currdir+"test4_sol.txt")
40       
41
42if __name__ == "__main__":
43   unittest.main()
Note: See TracBrowser for help on using the repository browser.