[Cython] Skip sensitivity-related tests when Sundials is not present
This commit is contained in:
parent
86db08ac88
commit
695b6b1266
5 changed files with 14 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from ._cantera import *
|
||||
from ._cantera import __version__
|
||||
from ._cantera import __version__, _have_sundials
|
||||
from .liquidvapor import *
|
||||
|
||||
import os as _os
|
||||
|
|
|
|||
|
|
@ -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 +
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -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) \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue