run_tests.py script¶
Notes on writing new test files:¶
A test file can contain anything, but usually it is similar to a regular input file (defining a test problem), with a mandatory Test class. This class holds all the test_* functions, as well as the from_conf(), which serves to initialize the test (conf is in fact the test file itself, options are command-line options).
All variables defined in a test file are collected in ‘conf’ variable passed to a Test.__init__(). For example, ‘input_name’ in test_input_*.py files is accessible as ‘conf.input_name’. This is usefull if the test class is defined outside the test file, as the classes in tests_basic.py are.
The test_* functions are collected automatically by run_tests.py, with one exception: if a certain order of their evaluation is required, a class attribute ‘test’ of the Test class with a list of the test function names should be defined (example: test_meshio.py).