[Python] Replace _have_sundials() with __sundials_version__

Resolves #259.
This commit is contained in:
Ray Speth 2015-05-26 16:47:38 -04:00
parent b42013009f
commit dcf7a2bdff
3 changed files with 7 additions and 5 deletions

View file

@ -1,5 +1,5 @@
from ._cantera import *
from ._cantera import __version__, _have_sundials
from ._cantera import __version__, __sundials_version__
from .liquidvapor import *
from .onedim import *
from .utils import *

View file

@ -769,7 +769,7 @@ class TestFlowReactor(utilities.CanteraTest):
self.assertNear(v0, r.speed)
self.assertNear(r.distance, v0 * t)
@unittest.skipUnless(ct._have_sundials(),
@unittest.skipUnless(ct.__sundials_version__,
"Disabled until there is an interface for setting the "
"max_err_test_fails parameter for the old CVODE")
def test_reacting(self):
@ -898,7 +898,7 @@ class TestWallKinetics(utilities.CanteraTest):
self.assertFalse(bool(bad), bad)
@unittest.skipUnless(ct._have_sundials(),
@unittest.skipUnless(ct.__sundials_version__,
"Sensitivity calculations require Sundials")
class TestReactorSensitivities(utilities.CanteraTest):
def test_sensitivities1(self):

View file

@ -26,8 +26,10 @@ def add_directory(directory):
""" Add a directory to search for Cantera data files. """
CxxAddDirectory(stringify(directory))
def _have_sundials():
return bool(get_sundials_version())
if get_sundials_version():
__sundials_version__ = '.'.join(str(get_sundials_version()))
else:
__sundials_version__ = None
__version__ = pystr(get_cantera_version())