[Cython] Skip sensitivity-related tests when Sundials is not present

This commit is contained in:
Ray Speth 2012-12-26 23:55:54 +00:00
parent 86db08ac88
commit 695b6b1266
5 changed files with 14 additions and 1 deletions

View file

@ -1,5 +1,5 @@
from ._cantera import *
from ._cantera import __version__
from ._cantera import __version__, _have_sundials
from .liquidvapor import *
import os as _os

View file

@ -426,6 +426,8 @@ cdef extern from "cantera/oneD/Sim1D.h":
cdef extern from "wrappers.h":
# config definitions
cdef string get_cantera_version()
cdef int get_sundials_version()
# ThermoPhase composition
cdef void thermo_getMassFractions(CxxThermoPhase*, double*) except +
cdef void thermo_setMassFractions(CxxThermoPhase*, double*) except +

View file

@ -1,4 +1,5 @@
import numpy as np
import unittest
import re
import cantera as ct
@ -530,6 +531,8 @@ class TestWallKinetics(utilities.CanteraTest):
self.assertArrayNear(C_left, C_right)
@unittest.skipUnless(ct._have_sundials(),
"Sensitivity calculations require Sundials")
class TestReactorSensitivities(utilities.CanteraTest):
def test_sensitivities1(self):
net = ct.ReactorNet()

View file

@ -19,4 +19,7 @@ cdef pystr(string x):
def addDirectory(directory):
CxxAddDirectory(stringify(directory))
def _have_sundials():
return bool(get_sundials_version())
__version__ = pystr(get_cantera_version())

View file

@ -8,6 +8,11 @@ std::string get_cantera_version()
return std::string(CANTERA_VERSION);
}
int get_sundials_version()
{
return SUNDIALS_VERSION;
}
// Function which populates a 1D array
#define ARRAY_FUNC(PREFIX, CLASS_NAME, FUNC_NAME) \
void PREFIX ## _ ## FUNC_NAME(Cantera::CLASS_NAME* object, double* data) \