[Test] Make testing of deprecated methods possible

Fatal deprecation warnings are useful for identifying inadvertent use of
deprecated features. However, we still want to retain tests of deprecated
features until those features are removed.
This commit is contained in:
Ray Speth 2019-06-25 11:57:27 -04:00
parent df5a3ae08f
commit dced8fbcad
4 changed files with 7 additions and 0 deletions

View file

@ -71,6 +71,7 @@ cdef extern from "cantera/base/global.h" namespace "Cantera":
cdef XML_Node* CxxGetXmlFile "Cantera::get_XML_File" (string) except +translate_exception
cdef XML_Node* CxxGetXmlFromString "Cantera::get_XML_from_string" (string) except +translate_exception
cdef void Cxx_make_deprecation_warnings_fatal "Cantera::make_deprecation_warnings_fatal" ()
cdef void Cxx_suppress_deprecation_warnings "Cantera::suppress_deprecation_warnings" ()
cdef void Cxx_suppress_thermo_warnings "Cantera::suppress_thermo_warnings" (cbool)
cdef string CxxGitCommit "Cantera::gitCommit" ()

View file

@ -40,6 +40,9 @@ def appdelete():
def make_deprecation_warnings_fatal():
Cxx_make_deprecation_warnings_fatal()
def suppress_deprecation_warnings():
Cxx_suppress_deprecation_warnings()
def suppress_thermo_warnings(pybool suppress=True):
Cxx_suppress_thermo_warnings(suppress)

View file

@ -338,6 +338,7 @@ public:
//! prevent certain tests from failing.
void suppress_deprecation_warnings() {
m_suppress_deprecation_warnings = true;
m_fatal_deprecation_warnings = false;
}
//! Turns deprecation warnings into exceptions. Activated within the test

View file

@ -335,8 +335,10 @@ TEST(ThermoFromYaml, PureFluid_nitrogen)
TEST(ThermoFromYaml, ConstDensityThermo)
{
suppress_deprecation_warnings();
auto thermo = newThermo("thermo-models.yaml", "const-density");
EXPECT_DOUBLE_EQ(thermo->density(), 700.0);
make_deprecation_warnings_fatal();
}
TEST(ThermoFromYaml, IdealSolidSolnPhase)