From b3f1a736630369e4c72dbb1c61d915f4dc9d7b1e Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Thu, 16 Sep 2021 14:38:07 -0400 Subject: [PATCH] [Test] Skip conversion tests if no Python package is being built Converting between different mechanism formats require at least the "minimal" Python package to be built. --- test/SConscript | 2 ++ test/kinetics/rates.cpp | 4 ++++ test/thermo/phaseConstructors.cpp | 2 ++ test_problems/SConscript | 5 +++-- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/test/SConscript b/test/SConscript index 1ecb5df2d..c709739d5 100644 --- a/test/SConscript +++ b/test/SConscript @@ -96,6 +96,8 @@ def addTestProgram(subdir, progName, env_vars={}): testenv['ENV'].update(env_vars) if env["skip_slow_tests"]: testenv.Append(CPPDEFINES=["CT_SKIP_SLOW"]) + if env["python_package"] == "none": + testenv.Append(CPPDEFINES=["CT_NO_PYTHON"]) program = testenv.Program(pjoin(subdir, progName), multi_glob(testenv, subdir, 'cpp')) passedFile = File(pjoin(str(program[0].dir), '%s.passed' % program[0].name)) diff --git a/test/kinetics/rates.cpp b/test/kinetics/rates.cpp index 1c223da75..1194ad93d 100644 --- a/test/kinetics/rates.cpp +++ b/test/kinetics/rates.cpp @@ -9,6 +9,7 @@ namespace Cantera { +#ifndef CT_NO_PYTHON TEST(FracCoeff, ConvertFracCoeff) { IdealGasPhase thermo1("../data/frac.cti", "gas"); @@ -33,6 +34,7 @@ TEST(FracCoeff, ConvertFracCoeff) } } } +#endif class FracCoeffTest : public testing::Test { @@ -181,11 +183,13 @@ public: size_t nRxn, nSpec; }; +#ifndef CT_NO_PYTHON TEST_F(NegativePreexponentialFactor, fromCti) { setup("../data/noxNeg.cti"); testNetProductionRates(); } +#endif TEST_F(NegativePreexponentialFactor, fromYaml) { diff --git a/test/thermo/phaseConstructors.cpp b/test/thermo/phaseConstructors.cpp index 65524429b..98a3de67f 100644 --- a/test/thermo/phaseConstructors.cpp +++ b/test/thermo/phaseConstructors.cpp @@ -118,6 +118,7 @@ TEST(IonsFromNeutralConstructor, fromScratch) EXPECT_NEAR(mu[1], -2.88157316e+06, 1e-1); } +#ifndef CT_NO_PYTHON class CtiConversionTest : public testing::Test { public: @@ -177,6 +178,7 @@ TEST_F(ChemkinConversionTest, FailedConversion) { ASSERT_THROW(ck2cti("h2o2_missingThermo.inp"), CanteraError); } +#endif class ConstructFromScratch : public testing::Test { diff --git a/test_problems/SConscript b/test_problems/SConscript index 6ed07e3b1..dd6cd2494 100644 --- a/test_problems/SConscript +++ b/test_problems/SConscript @@ -200,8 +200,9 @@ CompileAndTest('CpJump', 'CpJump', 'CpJump', 'output_blessed.txt') diamond = CompileAndTest('diamondSurf-yaml', 'diamondSurf', 'diamondSurf', 'runDiamond_blessed.out', options='diamond.yaml') -Test('diamondSurf-cti', 'diamondSurf', diamond.program, 'runDiamond_blessed.out', - options='diamond.cti') # @TODO: remove after Cantera 2.6 +if env["python_package"] != "none": + Test('diamondSurf-cti', 'diamondSurf', diamond.program, 'runDiamond_blessed.out', + options='diamond.cti') # @TODO: remove after Cantera 2.6 Test('diamondSurf-xml', 'diamondSurf', diamond.program, 'runDiamond_blessed.out', options='diamond.xml') # @TODO: remove after Cantera 2.6