Feature #1486
Add a way to test an installed version of Gammalib
Status: | Closed | Start date: | 06/28/2015 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assigned To: | Knödlseder Jürgen | % Done: | 100% | |
Category: | - | |||
Target version: | 1.0.0 | |||
Duration: |
Description
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.
Recurrence
No recurrence.
History
#1 Updated by Deil Christoph over 9 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 over 9 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 over 9 years ago
- Status changed from In Progress to Pull request
Does this look OK?
https://github.com/ctools/ctools/compare/devel...cdeil:ctools-test-function
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.
#4 Updated by Knödlseder Jürgen over 9 years ago
- Status changed from Pull request to In Progress
- % Done changed from 0 to 30
I merged your code into devel
.
As this feature also holds for GammaLib I leave it open for now so that we don’t forget about adding tests to GammaLib.
#5 Updated by Knödlseder Jürgen about 9 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.
#6 Updated by Knödlseder Jürgen about 9 years ago
- Status changed from In Progress to Pull request
- % Done changed from 50 to 100
I also added the same logic to GammaLib. Now both commands work:
python -c 'import gammalib; gammalib.test()' python -c 'import ctools; ctools.test()'
#7 Updated by Knödlseder Jürgen about 9 years ago
- Status changed from Pull request to Closed
Merged into devel
.