Add a way to test an installed version of Gammalib
|Assigned To:||Knödlseder Jürgen||% Done:|
As far as I can see Gammalib / ctools only has tests that can be executed from the source folder?
This means that in common scenarios users have no way to test if the Gammalib / ctools they are using is OK.
- Someone installed Gammalib / ctools on a shared server.
- The user downloaded a binary version (i.e. most users in the future).
For Python packages the common thing to do (numpy, scipy, matplotlb, astropy) is to install the test files and have a test function, i.e. the user should be able to run:
python -c 'import gammalib; gammalib.test()' python -c 'import ctools; ctools.test()'
For C / C++ libraries it’s not that common ... there could be a binary gammalib-test and ctools-test if there are things that can’t easily be tested from Python.
I guess for Gammalib / ctools, these tests would have to be different from the ones dev runs from the source folder, because example files are not available and the execution environment is different and ...
Jürgen, I’m willing to work on this this week if you think it’s useful to have before 1.0.
#1 Updated by Deil Christoph almost 7 years ago
- Target version set to 1.0.0
We just discussed this at the ctools coding sprint.
Adding this to the 1.0 target.
The goal for 1.0 is: add `gammalib.test()` and `ctools.test()` Python functions that run some analyses (like the ones from the examples folder).
Long-term it would be good to change the whole test suite so that it can be installed, but that’s a lot of work and will be left for after 1.0.
#2 Updated by Deil Christoph almost 7 years ago
- Status changed from New to In Progress
- Assigned To set to Deil Christoph
A first working version: https://github.com/ctools/ctools/compare/devel...cdeil:ctools-test-function
OK or should I change the testing framework before I continue?
(not sure if this works on Pythons as old as 2.4)
The best Python testing framework is http://pytest.org/
Bundling it is a single large file (200kB).
#3 Updated by Deil Christoph almost 7 years ago
- Status changed from In Progress to Pull request
There’s currently two tests for the file-based and in-memory unbinned analysis pipeline.
More tests and asserts could be added easily, but this would duplicate what’s written in the `tests` folder.
#5 Updated by Knödlseder Jürgen over 6 years ago
- Assigned To changed from Deil Christoph to Knödlseder Jürgen
- % Done changed from 30 to 50
I changed the logic so that the ctools Python unit tests from the
test folder are used. This provides an already complete test suite and avoids code duplication.