pyccel.commands.pyccel_test module#
Module containing scripts to run the unit tests of Pyccel
- pyccel.commands.pyccel_test.pyccel_test(*, folder, dry_run, verbose, language, run_mpi)[source]#
Run the unit tests of Pyccel.
This function runs the unit tests of Pyccel using pytest. If pytest is not installed, it will print an error message and exit. It also downloads the test files from GitHub and unzips them into the current directory. The function then changes into the test directory and runs the tests using pytest. The tests are run in two stages: first, the single-process tests which must be run one at a time are run, and then the single-process tests which can be run in parallel are run. The function returns the return code of the pytest command.
If the user stops the tests with Ctrl+C, the function will print a message and exit gracefully.
This function does not provide default values for its parameters, because these have to be handled by the command line parser.
- Parameters:
folder (pathlib.Path or None) – The local folder where the tests are located. If None, the function will first try to extract the tests from a local editable installation, then download them from the official GitHub repository.
dry_run (bool) – If True, the function will not run the tests, but will print the commands that would be run.
verbose (int) – The verbosity level of the output. The higher the number, the more detailed the output will be.
language (str) – The target language Pyccel is translating to. Default is ‘all’.
run_mpi (bool) – If True, the function will not run the parallel tests.
- Returns:
The return code of the pytest command. If the tests were interrupted by the user, the return code will be pytest.ExitCode.INTERRUPTED. If the tests failed, the return code will be pytest.ExitCode.TESTS_FAILED. If the tests passed, the return code will be pytest.ExitCode.OK.
- Return type:
pytest.ExitCode