Repository: OpenMDAO/OpenMDAO

Issue:
When pyoptsparse isn't installed, a RuntimeError is raised instead of an ImportError.
### Desired capability or behavior.

When the pyOptSparseDriver detects that pyOptSparse has not been installed, it raises a RuntimeError:

        if pyoptsparse is None:
            # pyoptsparse is not installed
            raise RuntimeError('pyOptSparseDriver is not available, pyOptsparse is not installed.')

Should this be an ImportError instead? This would help you group the error with other ImportErrors that are also due to missing packages. 

### Associated POEM

This is a small change.

Discussion:

Solution patch:
diff --git a/openmdao/drivers/pyoptsparse_driver.py b/openmdao/drivers/pyoptsparse_driver.py
index ed8d93199..9f11b6ff2 100644
--- a/openmdao/drivers/pyoptsparse_driver.py
+++ b/openmdao/drivers/pyoptsparse_driver.py
@@ -191,7 +191,7 @@ class pyOptSparseDriver(Driver):
         """
         if pyoptsparse is None:
             # pyoptsparse is not installed
-            raise RuntimeError('pyOptSparseDriver is not available, pyOptsparse is not installed.')
+            raise ImportError('pyOptSparseDriver is not available, pyOptsparse is not installed.')
 
         if isinstance(pyoptsparse, Exception):
             # there is some other issue with the pyoptsparse installation


Test patch:
diff --git a/openmdao/drivers/tests/test_pyoptsparse_driver.py b/openmdao/drivers/tests/test_pyoptsparse_driver.py
index 358e28e34..02690b2c1 100644
--- a/openmdao/drivers/tests/test_pyoptsparse_driver.py
+++ b/openmdao/drivers/tests/test_pyoptsparse_driver.py
@@ -157,7 +157,7 @@ class TestNotInstalled(unittest.TestCase):
         from openmdao.drivers.pyoptsparse_driver import pyOptSparseDriver
 
         # but we get a RuntimeError if we try to instantiate
-        with self.assertRaises(RuntimeError) as ctx:
+        with self.assertRaises(ImportError) as ctx:
             pyOptSparseDriver()
 
         self.assertEqual(str(ctx.exception),