Unit Tests

Structure

To test functionality within mewarpx, a unit test is written for the new module using the following format

test_<module_name>.py

Within each unit test are functions in the underlying module that check whether each aspect of the module is working properly. Each test function follows the format

def test_<function_name>():

and must assert True if the test should pass or assert False if the test should fail at the last statement of the function. The assertions should compare some result of the function (current, charge density, electric potential etc.) to a known result located in tests/test_files/Result_Stats. Typically, a single unit test should not run for too long, 30 seconds to 1 minute or less.

All test files for mewarpx are located in the tests directory. For each pull request into ModernElectron/WarpX, CircleCi will execute all tests with pytest to determine if all tests pass.