-
Notifications
You must be signed in to change notification settings - Fork 0
about test
Kohei Noda edited this page Feb 8, 2024
·
11 revisions
- Test is a process to check if the program works as expected.
- This project uses pytest to test.
- The test is run automatically when you push to the main branch or create a pull request.
- We recommend that you write unit tests for small feature units when creating new features.
- You can refer to the unit test directory of this project to learn how to write unit tests.
- This project tests whether the CASPT2 energy has an error of more than a certain amount. The error is allowed to be up to ±10-8 a.u.
- For new features, we also create feature-level unit tests.
- You need to install pytest to run tests.
- You can install pytest by running the following command (Python 3.6 or later is required).
python -m pip install pytest
- Once you have installed pytest, you can run the tests by running the following command.
pytest --dev
-
In this project, we use markers to avoid running unnecessary long tests according to the test execution time.
- If you have tests that you don't want to run, you can specify them with --ignore=path/to/ignore, and the tests under /path/to/ignore will be ignored.
- Tests are marked with @pytest.mark.dev, no marker, and @pytest.mark.slowonly in order of lightness of test.
- If you pass an argument to pytest, you can control which tests to run. The arguments are as follows.
# Run only the tests with @pytest.mark.dev pytest --dev # Run the tests with no marker and @pytest.mark.dev pytest # Run all tests pytest --all # Run only the tests with @pytest.mark.slowonly pytest --slowonly
- If you are using a parallel compiler such as mpiifort, mpiifx, mpif90, or mpifort, and you have enabled the --mpi option at build time, we recommend that you run MPI parallel tests. The command is as follows.
pytest --dev --mpi=4
- we use Github Actions to automatically run tests for commits that upload (push) files such as *.f90, *.F90, *.cmake, CMakeLists.txt, *.py, and Github Actions files.
- Github Actions settings are in .github/workflows/ci.yml.