diff --git a/doc/install.rst b/doc/install.rst index 0cb472ff..4b1ea597 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -35,12 +35,7 @@ pyOptSparse has the following dependencies: Please make sure these are installed and available for use. In order to use NSGA2, SWIG (v1.3+) is also required, which can be installed via the package manager. -If those optimizers are not needed, then you do not need to install SWIG. -Simply comment out the corresponding lines in ``pyoptsparse/pyoptsparse/meson.build`` so that they are not compiled. -The corresponding lines in ``pyoptsparse/pyoptsparse/__init__.py`` must be commented out as well. - Python dependencies are automatically handled by ``pip``, so they do not need to be installed separately. -The only exception is ``numpy``, which is required as part of the build process and therefore must be present before installing. .. note:: * In Linux, the python header files (``python-dev``) are also required. diff --git a/tests/test_nsga2_multi_objective.py b/tests/test_nsga2_multi_objective.py index 0fe7f57a..614ff187 100644 --- a/tests/test_nsga2_multi_objective.py +++ b/tests/test_nsga2_multi_objective.py @@ -3,7 +3,6 @@ # Standard Python modules import sys import unittest -import warnings # External modules from numpy.testing import assert_allclose @@ -19,6 +18,14 @@ class TestNSGA2(OptTest): name = "quadratic" optName = "NSGA2" + histFileName = None + + def setUp(self): + try: + # First party modules + from pyoptsparse.pyNSGA2 import nsga2 # noqa: F401 + except ImportError: + raise unittest.SkipTest("Optimizer not available: NSGA2") def objfunc(self, xdict): x = xdict["x"] @@ -43,6 +50,9 @@ def setup_optProb(self, n_obj): if n_obj == 2: self.optProb.addObj("obj2") + @unittest.skipIf( + sys.platform == "win32", "test_nsga2_multi_objective.py fails on windows with two objectives! Skipping for now." + ) @parameterized.expand([(1,), (2,)]) def test_opt(self, n_obj): if n_obj == 2: @@ -51,11 +61,7 @@ def test_opt(self, n_obj): # 300 generations will find x=(0,0), 200 or less will find x=(1,1) optOptions = {"maxGen": 200} - if sys.platform == "win32": - warnings.warn( - "test_nsga2_multi_objective.py fails on windows with two objectives! Skipping for now.", stacklevel=2 - ) - return + sol = self.optimize(optOptions=optOptions) tol = 1e-2 if n_obj == 1: diff --git a/tests/testing_utils.py b/tests/testing_utils.py index b0bccd73..9d5a8a55 100644 --- a/tests/testing_utils.py +++ b/tests/testing_utils.py @@ -61,7 +61,7 @@ def get_dict_distance(d, d2): } # these are optimizers which are installed by default -DEFAULT_OPTIMIZERS = {"SLSQP", "PSQP", "CONMIN", "ALPSO", "NSGA2"} +DEFAULT_OPTIMIZERS = {"SLSQP", "PSQP", "CONMIN", "ALPSO"} # Define gradient-based optimizers GRAD_BASED_OPTIMIZERS = {"CONMIN", "IPOPT", "NLPQLP", "ParOpt", "PSQP", "SLSQP", "SNOPT"}