Testing
To run the automated tests, go to the main source directory and execute the following:
pytest
Tests that are parallelizable have to run with runtests.
python run-tests.py --no-build
You can choose the number of processors with the option --mpirun="mpirun -np 4"
. For development purposes you can go beyond the number of processors of your computer using --mpirun="mpirun -np 10 --oversubscribe"
Other usefull flags:
--xterm
: one window per processor--xterm --pdb
: debugging
Linter
CI will check the code using the flake8
linter.
Before pushing, make sure to run the tests also with the linter activated:
pytest --flake8
To run only the linter and not the tests:
pytest --flake8 -m flake8
To check a file individually:
python3 -m flake8 --max-complexity 10
You can configure this as Preferences->Tools->External Tools in Pycharm:
set Program to
$PyInterpreterDirectory$/python3
set Arguments to
-m flake8 --max-complexity 10 $FilePath$
set Working Directory to
$ProjectFileDir$