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
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)
def test_bad_branch_signature(self): problem = BadBranchSignatureProblem() with pytest.raises(TypeError): solve(problem, comm=None)
def test_bad_queue_strategy(self): with pytest.raises(ValueError): solve(DummyProblem(), comm=None, queue_strategy='_not_a_valid_strategy_')