Running nexus tests - next-exp/nexus GitHub Wiki

Before submitting a pull request, the test suite must be run, to ensure that the new code does not introduce errors.

NEXUS has two types of tests.

The first type of tests relies on the Catch2 test framework. It is written in C++ and encloses tests related to specific nexus functions, which don't need to run a complete nexus simulation. During nexus compilation, the nexus-test executable is created, together with the main nexus executable. To run this type of tests, you just need to run this executable from the main directory: bin/nexus-test.

The second type of tests uses the pytest python package. It runs nexus simulations and analyzes the output. To run this type of tests, you need to have a conda installation and to create an environment with the packages listed in scripts/test_environment.yml with the following command:

conda env create -f scripts/test_environment.yml

Every time you use it, you need to activate it with:

conda activate tests

To run the tests, just type pytest from the main nexus folder.

If a different version of the hdf5 package from the one in the tests environment is used to produce nexus output, an error may appear running the tests. In that case the command

export HDF5_DISABLE_VERSION_CHECK=1 

should solve the problem.

Remember: to run the tests, as well as to run nexus, you need to execute the setup script, placed in the scripts folder.

  • If you use a macOS more recent than Mojave (version >= 10.15), you should execute:

source /path/to/scripts/nexus_setup.zsh

  • For the rest of operative systems:

source /path/to/scripts/nexus_setup.sh

It will set the NEXUSDIR variable to the top level directory of the installation.