Changeset 2421


Ignore:
Timestamp:
Mar 11, 2010 6:01:08 PM (9 years ago)
Author:
wehart
Message:

Rework of unit tests to (a) import pyutilib.th as 'unittest' and
(b) employ test skipping.

Location:
coopr.plugins/trunk/coopr/plugins/tests/mip
Files:
6 edited

Legend:

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

    r2308 r2421  
    1111currdir = dirname(abspath(__file__))+os.sep
    1212
    13 import unittest
    1413from nose.tools import nottest
    15 import pyutilib.th
     14import pyutilib.th as unittest
    1615import pyutilib.services
    1716import pyutilib.common
     
    3635
    3736
    38 class mock_all(pyutilib.th.TestCase):
     37class mock_all(unittest.TestCase):
    3938
    4039    def setUp(self):
     
    155154
    156155
     156@unittest.skipIf(not cplexamp_available, "The 'cplexamp' command is not available")
    157157class mip_all(mock_all):
    158 
    159     def run(self, result=None):
    160         global cplexamp_available
    161         if not cplexamp_available:
    162            return
    163         mock_all.run(self,result)
    164158
    165159    def setUp(self):
  • coopr.plugins/trunk/coopr/plugins/tests/mip/test_cbc.py

    r2349 r2421  
    1111currdir = dirname(abspath(__file__))+os.sep
    1212
    13 import pyutilib.th
     13import pyutilib.th as unittest
    1414import pyutilib.common
    1515import pyutilib.services
    16 import unittest
    1716from nose.tools import nottest
    1817import coopr.plugins.mip
     
    3837
    3938
    40 class mock_all(pyutilib.th.TestCase):
     39class mock_all(unittest.TestCase):
    4140
    4241    def setUp(self):
     
    156155
    157156
     157@unittest.skipIf(not cbc_available, "The 'cbc' command is not available")
    158158class mip_all(mock_all):
    159 
    160     def run(self, result=None):
    161         """
    162         Run the same tests, but only if CBC is available
    163         """
    164         global cbc_available
    165         if not cbc_available:
    166            return
    167         mock_all.run(self,result)
    168159
    169160    def setUp(self):
  • coopr.plugins/trunk/coopr/plugins/tests/mip/test_convert.py

    r2266 r2421  
    1212
    1313import re
    14 import unittest
    1514from nose.tools import nottest
    1615import coopr.plugins
    1716from coopr.opt import ProblemFormat, ConverterError
    1817import coopr
    19 import pyutilib.th
     18import pyutilib.th as unittest
    2019import pyutilib.services
    2120import pyutilib.common
     
    7271
    7372
    74 class Test(pyutilib.th.TestCase):
     73class Test(unittest.TestCase):
    7574
    7675    def setUp(self):
  • coopr.plugins/trunk/coopr/plugins/tests/mip/test_cplex.py

    r2308 r2421  
    1111currdir = dirname(abspath(__file__))+os.sep
    1212
    13 import unittest
    1413from nose.tools import nottest
    15 import pyutilib.th
     14import pyutilib.th as unittest
    1615import pyutilib.services
    1716import pyutilib.common
     
    3534
    3635
    37 class mock_all(pyutilib.th.TestCase):
     36class mock_all(unittest.TestCase):
    3837
    3938    def setUp(self):
     
    154153
    155154
     155@unittest.skipIf(not cplex_available, "The CPLEX solver is not available")
    156156class mip_all(mock_all):
    157 
    158     def run(self, result=None):
    159         global cplex_available
    160         if not cplex_available:
    161            return
    162         mock_all.run(self,result)
    163157
    164158    def setUp(self):
  • coopr.plugins/trunk/coopr/plugins/tests/mip/test_glpk.py

    r2380 r2421  
    1111currdir = dirname(abspath(__file__))+os.sep
    1212
    13 import pyutilib.th
     13import pyutilib.th as unittest
    1414import pyutilib.common
    1515import pyutilib.services
    16 import unittest
    1716from nose.tools import nottest
    1817import coopr.plugins.mip
     
    4140
    4241
    43 class mock_all(pyutilib.th.TestCase):
     42class mock_all(unittest.TestCase):
    4443
    4544    def setUp(self):
     
    165164
    166165
     166@unittest.skipIf(not glpk_available, "The 'glpsol' command is not available")
    167167class mip_all(mock_all):
    168 
    169     def run(self, result=None):
    170         """
    171         Run the same tests, but only if GLPK is available
    172         """
    173         global glpk_available
    174         if not glpk_available:
    175            return
    176         mock_all.run(self,result)
    177168
    178169    def setUp(self):
  • coopr.plugins/trunk/coopr/plugins/tests/mip/test_pico.py

    r2308 r2421  
    1111currdir = dirname(abspath(__file__))+os.sep
    1212
    13 import unittest
    1413from nose.tools import nottest
    15 import pyutilib.th
     14import pyutilib.th as unittest
    1615import pyutilib.common
    1716import pyutilib.services
     
    3736
    3837
    39 class mock_all(pyutilib.th.TestCase):
     38class mock_all(unittest.TestCase):
    4039
    4140    def setUp(self):
     
    154153
    155154
     155@unittest.skipIf(not pico_available, "The PICO solver is not available")
    156156class mip_all(mock_all):
    157 
    158     def run(self, result=None):
    159         global pico_available
    160         if not pico_available:
    161            return
    162         mock_all.run(self,result)
    163157
    164158    def setUp(self):
Note: See TracChangeset for help on using the changeset viewer.