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 exits with the exit code of the pytest command (see pytest.ExitCode enum).
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.
Notes
This function exits with sys.exit(final_retcode), where final_retcode is one of the Pytest exit codes encoded by the enumeration pytest.ExitCode. If the tests were interrupted by the user, the exit code is pytest.ExitCode.INTERRUPTED. If the tests failed, the exit code is pytest.ExitCode.TESTS_FAILED. If the tests passed, the exit code is pytest.ExitCode.OK.
- pyccel.commands.pyccel_test.pyccel_test_command()[source]#
Command line wrapper for the deprecated pyccel-test command line tool.
Command line wrapper for the deprecated pyccel-test command line tool.
- Returns:
The pytest return code.
- Return type:
pytest.ExitCode
- pyccel.commands.pyccel_test.setup_pyccel_test_parser(parser, add_version=False)[source]#
Add the pyccel test arguments to the parser.
Add the pyccel test arguments to the parser for command line arguments.
- Parameters:
parser (argparse.ArgumentParser) – The parser to be modified.
add_version (bool, default=False) – Indicates whether a –version flag should be added to the command. This option will be removed in v2.3.