PythonUnitTest
The PythonUnitTest tester is used to run Python scripts in the MOOSE test suite. These are usually unit tests, but can also be running a Method of Manufactured solutions study. The test passes if the python scripts returns normally, and fails if an error/exception is met.
Recover testing and valgrind memory-checking is disabled by default for the PythonUnitTest.
Options
Test configuration options are specified in the tests file.
input: The python input file to use for this testtest_case: The specific test case to run. Defaults to all test cases in the modulebuffer: Equivalent to passing-bor--bufferto the unittest. Defaults to Falseseparate: Run each test in the file in a separate subprocess. Defaults to False
Other test commands & restrictions may be found in the TestHarness documentation.
Example test configuration in the MOOSE test suite
In this example, PythonUnitTests are used to perform method of manufactured solutions studies of advection outflow boundary conditions with a finite volume discretization. The python mms scripts can compute the order of convergence of the mesh by running multiple simulations with increasing discretization. They then check this convergence against the expected discretization. If the desired order of convergence is not met, the scripts error out, which is caught by the tester.
[Tests]
design = 'fv_design.md'
[test]
type = Exodiff
input = advection-diffusion.i
exodiff = advection-diffusion_out.e
requirement = 'The system shall be able to to solve an advection-diffusion equation with a dirichlet condition on the left boundary and a zero gradient condition on the right boundary and display second order convergence with the finite volume method.'
issues = '#14549'
[]
[outflow]
requirement = 'The system shall, while using an advective outflow boundary condition, demonstrate second order convergence if a two term Taylor series is used to approximate boundary face values and reduced order convergence if a one term Taylor series is used. These converges rates shall be observed with'
issues = '#14549 #24466'
[average]
type = MMSTest
input = test.py
test_case = TestOutflow
detail = 'a weighted averaging advection interpolation, and'
[]
[minmod]
type = MMSTest
input = test.py
test_case = TestOutflowMinMod
detail = 'a min-mod advection interpolation scheme.'
min_parallel = 2 # Test geometric and algebraic ghosting
[]
[]
[extrapolate]
type = MMSTest
input = test.py
test_case = TestExtrapolation
issues = '#16169 #14549'
requirement = 'The system shall be able to do one-term and two-term Taylor expansions for extrapolating finite volume solutions to boundary faces, and these extrapolations should be usable by flux kernels at inflow/outflow boundaries to produce first and second order accurate solutions respectively as measured by an L2 norm.'
[]
[UpwindLimiter]
type = MMSTest
input = test.py
test_case = UpwindLimiter
requirement = 'The system shall display first order convergence with an upwind limiter.'
issues = '#14549'
[]
[CentralDifferenceLimiter]
type = MMSTest
input = test.py
test_case = CentralDifferenceLimiter
requirement = 'The system shall display second order convergence with a central-differencing limiter.'
issues = '#14549'
[]
[VanLeerLimiter]
type = MMSTest
input = test.py
test_case = VanLeerLimiter
requirement = 'The system shall display second order convergence with a Van-Leer limiter.'
issues = '#14549'
[]
[MinModLimiter]
type = MMSTest
input = test.py
test_case = MinModLimiter
requirement = 'The system shall display second order convergence with a min-mod limiter.'
issues = '#14549'
[]
[SOULimiter]
type = MMSTest
input = test.py
test_case = SOULimiter
requirement = 'The system shall display second order convergence with a second-order-upwind limiter.'
issues = '#14549'
[]
[QUICKLimiter]
type = MMSTest
input = test.py
test_case = QUICKLimiter
requirement = 'The system shall display second order convergence with a QUICK limiter.'
heavy = true
issues = '#14549'
[]
[kt]
requirement = 'The system shall provide a Kurganov-Tadmor scheme for evaluating convective intercell fluxes'
issues = '#14549'
[KTLimitedCD]
type = MMSTest
input = test.py
test_case = KTLimitedCD
detail = 'with central difference interpolation of face values and resulting second order convergence'
min_slots = 2 # memory heavy
[]
[KTLimitedUpwind]
type = MMSTest
input = test.py
test_case = KTLimitedUpwind
min_slots = 2 # memory heavy and 2 MPI slots crashes
detail = 'with upwind interpolation of face values and resulting first order convergence'
[]
[KTLimitedVanLeer]
type = MMSTest
input = test.py
test_case = KTLimitedVanLeer
min_slots = 2 # memory heavy and 2 MPI slots crashes
detail = 'with central difference interpolation with Van-Leer limiting of face values and resulting two and a half order convergence' # I don't actually know where this additional half order is coming from
[]
[]
[]
(test/tests/fvkernels/mms/advective-outflow/tests)