Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BENCH: optimize_linprog remove ImportError exception #11443

Merged
merged 1 commit into from Jan 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 9 additions & 13 deletions benchmarks/benchmarks/optimize_linprog.py
@@ -1,21 +1,17 @@
"""
Benchmarks for Linear Programming
"""
from __future__ import division, print_function, absolute_import

# Import testing parameters
try:
from scipy.optimize import linprog, OptimizeWarning
from scipy.linalg import toeplitz
from scipy.optimize.tests.test_linprog import lpgen_2d, magic_square
from numpy.testing import suppress_warnings
from scipy.optimize._remove_redundancy import _remove_redundancy, _remove_redundancy_dense, _remove_redundancy_sparse
from scipy.optimize._linprog_util import _presolve, _clean_inputs, _LPProblem
from scipy.sparse import csc_matrix, csr_matrix, issparse
import numpy as np
import os
except ImportError:
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm almost certain we do this intentionally in benchmarks to allow for them to run smoothly over a very wide range of commits. You'll find it in many different places so that if a feature is missing the benchmarks may continue past that point in history.

@pv can correct me if I'm wrong

Copy link
Contributor

Choose a reason for hiding this comment

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

So while it may make debugging a little harder when running in a target manner, I think I'm probably -0.5 here at best.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know why os and numpy are being guarded though, so some things probably don't need to be. Just the SciPy features.

pass
from scipy.optimize import linprog, OptimizeWarning
from scipy.linalg import toeplitz
from scipy.optimize.tests.test_linprog import lpgen_2d, magic_square
from numpy.testing import suppress_warnings
from scipy.optimize._remove_redundancy import _remove_redundancy, _remove_redundancy_dense, _remove_redundancy_sparse
from scipy.optimize._linprog_util import _presolve, _clean_inputs, _LPProblem
from scipy.sparse import csc_matrix, csr_matrix, issparse
import numpy as np
import os

from .common import Benchmark

Expand Down