Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def get_version(rel_path):
zip_safe=False,
install_requires=[
'ortools>=9.9',
'numpy>=1.5',
'numpy>=1.5,<2',
'setuptools',
],
extras_require={
Expand Down
22 changes: 21 additions & 1 deletion tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,15 @@

SKIPPED_EXAMPLES = [
"ocus_explanations.py", # waiting for issues to be resolved
"psplib.py" # randomly fails on github due to file creation
"psplib.py", # randomly fails on github due to file creation
]

SOLVER_SPECIFIC_EXAMPLES = {
"pysat": ["prob044_steiner.py"],
"exact": ["exact_maximal_propagate.py"]
}
_SOLVER_SPECIFIC_EXAMPLES_REVERSE = {v:k for k,vs in SOLVER_SPECIFIC_EXAMPLES.items() for v in vs}

SKIP_MIP = ['npuzzle.py', 'tst_likevrp.py', 'sudoku_', 'pareto_optimal.py',
'prob009_perfect_squares.py', 'blocks_world.py', 'flexible_jobshop.py',
'mario', 'pareto_optimal','prob006_golomb.py', 'tsp.py', 'prob028_bibd.py', 'prob001_car_sequence.py'
Expand Down Expand Up @@ -59,6 +65,13 @@ def test_example(solver, example):
return pytest.skip(reason=f"exclude {example} for {solver}, too slow or solver-specific")
if solver == 'minizinc' and any(x in example for x in SKIP_MZN):
return pytest.skip(reason=f"exclude {example} for {solver}, too slow or solver-specific")
# Skip solver specific tests for which the solver is not installed
for skip_name in _SOLVER_SPECIFIC_EXAMPLES_REVERSE.keys():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I find skip_name unintuitive, maybe just example_name?

if skip_name in example:
if not SolverLookup.lookup(_SOLVER_SPECIFIC_EXAMPLES_REVERSE[skip_name]).supported():
pytest.skip(f"Skipped {example} due to solver {_SOLVER_SPECIFIC_EXAMPLES_REVERSE[skip_name]} not being available on the current system.")
else:
break

base_solvers = SolverLookup.base_solvers
try:
Expand Down Expand Up @@ -95,4 +108,11 @@ def test_advanced_example(example):
"""Loads the advanced example file and executes its __main__ block with no default solver set."""
if any(skip_name in example for skip_name in SKIPPED_EXAMPLES):
pytest.skip(f"Skipped {example}, waiting for issues to be resolved")
# Skip solver specific tests for which the solver is not installed
for skip_name in _SOLVER_SPECIFIC_EXAMPLES_REVERSE.keys():
if skip_name in example:
if not SolverLookup.lookup(_SOLVER_SPECIFIC_EXAMPLES_REVERSE[skip_name]).supported():
pytest.skip(f"Skipped {example} due to solver {_SOLVER_SPECIFIC_EXAMPLES_REVERSE[skip_name]} not being available on the current system.")
else:
break
test_example(None, example)
Loading