Beispiel #1
0
 def test_solve_function(self):
     fid, fname = tempfile.mkstemp()
     os.close(fid)
     try:
         solve(DummyProblem(), comm=None, log_filename=fname)
         assert os.path.exists(fname)
     finally:
         time.sleep(0.1)
         try:
             os.remove(fname)
         except:  #pragma:nocover
             pass
Beispiel #2
0
 def test_bad_best_options(self):
     node = Node()
     node.objective = None
     with pytest.raises(ValueError):
         solve(DummyProblem(), comm=None, best_node=node)
     node.objective = nan
     with pytest.raises(ValueError):
         solve(DummyProblem(), comm=None, best_node=node)
     node.objective = 0
     solve(DummyProblem(), comm=None, best_node=node)
Beispiel #3
0
 def test_bad_branch_signature(self):
     problem = BadBranchSignatureProblem()
     with pytest.raises(TypeError):
         solve(problem, comm=None)
Beispiel #4
0
 def test_bad_queue_strategy(self):
     with pytest.raises(ValueError):
         solve(DummyProblem(),
               comm=None,
               queue_strategy='_not_a_valid_strategy_')