Open tztsai opened 1 month ago
All tests pass locally for me, except for step 3 which we don't care about at the moment.
Discussed idea of generating idealized test case for integration test. Not necessarily physically meaningful but something that uses the code in a realistic manner.
@dsgoll123 will make a new small training set for new version ORCHIDEE
This PR rewrites the testing approach in SPINacc. Previously, tests were written to execute at the end of a run. There are two problems:
Instead, this PR introduces
pytest
, which allows users to run tests after a step of the pipeline has completed. To utilisepytest
all previous tests have been renamed totest_task*.py
and all functions now have atest
prefix.To summarise:
config.py
toconftest.py
(apytest
recognised configuration file)tests
files totest_task*.py
and all test functions renamed with a prefixtest_
utils.py
.utils.py
includes a recursive compare function, as this was necessary to check arrays of arrays.Execution
To run the tests, use the command
pytest tests/
.Automatic testing
The tests rely on a job being completed before execution as output data needs to be there for a comparison to happen. For automated testing (regression), this presents a problem. We have therefore shown how it may be possible to use github actions to run the job in advance and then execute a single test.
The automated job needs the following data to execute a test.
The zenodo data is approximately 1.1GB. We cannot run SPINacc from scratch because the data dependencies are just too large. This is explained more here
Testing is steered using a .github actions file.
.github/workflows/python.yml
, and assumes that the initialisation step has already been executed. Thereforeauxil.npy
andpackdata.npy
are already there.It does the following:
https://github.com/ma595/SPINacc-data.git
including:auxil.npy
(metadata) andpackdata.npy
vlad_data/vlad_data
sed
to change the execution paths and the test totest_clustering
. Equally, we could commit a file and move this to the appropriate location. (Doesn't have to beDEF_Trunk
, for example).varlist.json
to the appropriate path corresponding to the directory of the clonedvlad_data
.main.py
tests/test_task1.py
only.Outstanding issues
In order to merge the following issues should be addressed:
Closes #37 and #40.