-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TEST: warn user if gurobipy not installed
skipif() has the advantage of explicitly warning the user if tests are not included due to gurobipy not being installed. This is entirely similar to behavior in plot_test.py with matplotlib. This changeset replaces the `nonfree` marker, which was not friendly to newcomers: they would need to know to `pytest -m nonfree` if they wanted to test with Gurobi. Otherwise, `pytest` (without the marker) would silently not include those tests. The advantages of using the `nonfree` marker are: 1. emphasizing to the user that tests involve behavior by code without open source, 2. failing if the corresponding packages (gurobipy, possibly others in the future) are not installed. However, users who know enough to use `pytest -m nonfree` likely are aware of Gurobi's license and likely would notice a warning when tests are running, so indeed, skipif() is the best choice.
- Loading branch information
1 parent
3cc3a74
commit 2af6893
Showing
3 changed files
with
11 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
[pytest] | ||
addopts = --strict-markers -m 'not nonfree' | ||
markers = | ||
nonfree: marks tests as requiring nonfree (i.e., having restrictive licenses) dependencies | ||
addopts = --strict-markers |