Commit e71941d0b2f22ac701208d6ad1ed39f776cd1fee

Authored by Michael Mayer
2 parents ae1d935c cc5e351c

Merge branch 'devel' of https://cta-gitlab.irap.omp.eu/ctools/ctools into 1807-s…

…how_obs-example-script
.gitignore
@@ -83,7 +83,7 @@ test/*.trs @@ -83,7 +83,7 @@ test/*.trs
83 test/*.txt 83 test/*.txt
84 test/*.eps 84 test/*.eps
85 test/test_cscripts.sh 85 test/test_cscripts.sh
86 -test/test_examples.sh 86 +test/test_examples.py
87 test/reports/*.xml 87 test/reports/*.xml
88 test/butterfly.txt 88 test/butterfly.txt
89 test/.coverage 89 test/.coverage
configure.ac
@@ -1025,7 +1025,7 @@ AC_CONFIG_FILES([Makefile @@ -1025,7 +1025,7 @@ AC_CONFIG_FILES([Makefile
1025 test/test_cscripts.sh 1025 test/test_cscripts.sh
1026 test/test_python_ctools.sh 1026 test/test_python_ctools.sh
1027 test/test_python_cscripts.sh 1027 test/test_python_cscripts.sh
1028 - test/test_examples.sh 1028 + test/test_examples.py
1029 pyext/Makefile 1029 pyext/Makefile
1030 pyext/setup.py 1030 pyext/setup.py
1031 pyext/ctools/__init__.py 1031 pyext/ctools/__init__.py
@@ -1039,7 +1039,7 @@ AC_CONFIG_FILES([Makefile @@ -1039,7 +1039,7 @@ AC_CONFIG_FILES([Makefile
1039 [if test -f test/test_cscripts.sh; then chmod +x test/test_cscripts.sh; fi; 1039 [if test -f test/test_cscripts.sh; then chmod +x test/test_cscripts.sh; fi;
1040 if test -f test/test_python_ctools.sh; then chmod +x test/test_python_ctools.sh; fi; 1040 if test -f test/test_python_ctools.sh; then chmod +x test/test_python_ctools.sh; fi;
1041 if test -f test/test_python_cscripts.sh; then chmod +x test/test_python_cscripts.sh; fi; 1041 if test -f test/test_python_cscripts.sh; then chmod +x test/test_python_cscripts.sh; fi;
1042 - if test -f test/test_examples.sh; then chmod +x test/test_examples.sh; fi; 1042 + if test -f test/test_examples.py; then chmod +x test/test_examples.py; fi;
1043 if test -f testconf.sh; then chmod +x testconf.sh; fi]) 1043 if test -f testconf.sh; then chmod +x testconf.sh; fi])
1044 AC_OUTPUT 1044 AC_OUTPUT
1045 1045
examples/generate_prod3_irfs.py
@@ -69,31 +69,31 @@ if __name__ == '__main__': @@ -69,31 +69,31 @@ if __name__ == '__main__':
69 for entry in entries: 69 for entry in entries:
70 70
71 # Set optional attributes 71 # Set optional attributes
72 - if entry.has_key('rebin'): 72 + if 'rebin' in entry:
73 rebin = entry['rebin'] 73 rebin = entry['rebin']
74 else: 74 else:
75 rebin = False 75 rebin = False
76 - if entry.has_key('eascale'): 76 + if 'eascale' in entry:
77 eascale = entry['eascale'] 77 eascale = entry['eascale']
78 else: 78 else:
79 eascale = 1.0 79 eascale = 1.0
80 - if entry.has_key('bgdscale'): 80 + if 'bgdscale' in entry:
81 bgdscale = entry['bgdscale'] 81 bgdscale = entry['bgdscale']
82 else: 82 else:
83 bgdscale = 1.0 83 bgdscale = 1.0
84 - if entry.has_key('bgdethres'): 84 + if 'bgdethres' in entry:
85 bgdethres = entry['bgdethres'] 85 bgdethres = entry['bgdethres']
86 else: 86 else:
87 bgdethres = 1000.0 87 bgdethres = 1000.0
88 - if entry.has_key('bgdinfill'): 88 + if 'bgdinfill' in entry:
89 bgdinfill = entry['bgdinfill'] 89 bgdinfill = entry['bgdinfill']
90 else: 90 else:
91 bgdinfill = False 91 bgdinfill = False
92 - if entry.has_key('oversample'): 92 + if 'oversample' in entry:
93 oversample = entry['oversample'] 93 oversample = entry['oversample']
94 else: 94 else:
95 oversample = 1 95 oversample = 1
96 - if entry.has_key('norm1d'): 96 + if 'norm1d' in entry:
97 norm1d = entry['norm1d'] 97 norm1d = entry['norm1d']
98 else: 98 else:
99 norm1d = False 99 norm1d = False
sonar-project.properties
@@ -15,17 +15,13 @@ sonar.links.scm=https://cta-gitlab.irap.omp.eu/ctools/ctools @@ -15,17 +15,13 @@ sonar.links.scm=https://cta-gitlab.irap.omp.eu/ctools/ctools
15 # Path to source directories 15 # Path to source directories
16 sonar.sources=. 16 sonar.sources=.
17 17
18 -# Path to tests  
19 -#sonar.tests=test  
20 -  
21 # Path to include directories 18 # Path to include directories
22 sonar.cxx.includeDirectories=pyext,/home/jenkins/gcc/gcc492/include/c++/4.9.2,/home/jenkins/gcc/gcc492/include/c++/4.9.2/tr1,/home/jenkins/gcc/gcc492/include/c++/4.9.2/ext,/home/jenkins/gcc/gcc492/include/c++/4.9.2/x86_64-unknown-linux-gnu,/home/jenkins/gcc/gcc492/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include,/usr/include,/usr/include/bits,/usr/include/gnu,/usr/include/linux 19 sonar.cxx.includeDirectories=pyext,/home/jenkins/gcc/gcc492/include/c++/4.9.2,/home/jenkins/gcc/gcc492/include/c++/4.9.2/tr1,/home/jenkins/gcc/gcc492/include/c++/4.9.2/ext,/home/jenkins/gcc/gcc492/include/c++/4.9.2/x86_64-unknown-linux-gnu,/home/jenkins/gcc/gcc492/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include,/usr/include,/usr/include/bits,/usr/include/gnu,/usr/include/linux
23 sonar.cxx.missingIncludeWarnings=False 20 sonar.cxx.missingIncludeWarnings=False
24 21
25 # Exclusions 22 # Exclusions
26 -sonar.exclusions=pyext/ctools/**,pyext/build/**,pyext/setup.py,doc/**,test/dev/**  
27 -sonar.coverage.exclusions=pyext/ctools/**,pyext/build/**,examples/**,doc/**,test/dev/**  
28 -#sonar.test.exclusions= 23 +sonar.exclusions=cscripts/tests/**,pyext/build/**,pyext/ctools/*_wrap.cpp,pyext/ctools/tests/**,doc/**,test/dev/**
  24 +sonar.coverage.exclusions=test/science_verification.py,test/test_examples.py
29 25
30 # C++ configuration 26 # C++ configuration
31 sonar.cxx.cppcheck.reportPath=cppcheck-result.xml 27 sonar.cxx.cppcheck.reportPath=cppcheck-result.xml
test/Makefile.am
@@ -9,7 +9,7 @@ if WITH_PYTHON @@ -9,7 +9,7 @@ if WITH_PYTHON
9 TEST_CSCRIPTS = test_cscripts.sh 9 TEST_CSCRIPTS = test_cscripts.sh
10 TEST_PYTHON_CTOOLS = test_python_ctools.sh 10 TEST_PYTHON_CTOOLS = test_python_ctools.sh
11 TEST_PYTHON_CSCRIPTS = test_python_cscripts.sh 11 TEST_PYTHON_CSCRIPTS = test_python_cscripts.sh
12 - TEST_PYTHON_EXAMPLES = test_examples.sh 12 + TEST_PYTHON_EXAMPLES = test_examples.py
13 TEST_PYTHON_ENV = PYTHONPATH=$(top_builddir):$(top_builddir)/pyext:$(top_builddir)/pyext/build/ctools/ctools:$(pythondir):$(pyexecdir):$(PYTHONPATH) 13 TEST_PYTHON_ENV = PYTHONPATH=$(top_builddir):$(top_builddir)/pyext:$(top_builddir)/pyext/build/ctools/ctools:$(pythondir):$(pyexecdir):$(PYTHONPATH)
14 endif 14 endif
15 15
test/test_examples.py renamed to test/test_examples.py.in
@@ -58,7 +58,7 @@ class Test(gammalib.GPythonTestSuite): @@ -58,7 +58,7 @@ class Test(gammalib.GPythonTestSuite):
58 String with name to be used for logging 58 String with name to be used for logging
59 """ 59 """
60 # Setup command 60 # Setup command
61 - cmd = '../examples/' + name + '.py' 61 + cmd = '@PYTHON_COVERAGE@../examples/' + name + '.py'
62 if len(args) > 0: 62 if len(args) > 0:
63 cmd += ' ' + args 63 cmd += ' ' + args
64 64
test/test_examples.sh.in deleted
1 -#! /bin/sh  
2 -# ==========================================================================  
3 -# This script launches the examples unit tests  
4 -#  
5 -# Copyright (C) 2016 Juergen Knoedlseder  
6 -#  
7 -# This program is free software: you can redistribute it and/or modify  
8 -# it under the terms of the GNU General Public License as published by  
9 -# the Free Software Foundation, either version 3 of the License, or  
10 -# (at your option) any later version.  
11 -#  
12 -# This program is distributed in the hope that it will be useful,  
13 -# but WITHOUT ANY WARRANTY; without even the implied warranty of  
14 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
15 -# GNU General Public License for more details.  
16 -#  
17 -# You should have received a copy of the GNU General Public License  
18 -# along with this program. If not, see <http://www.gnu.org/licenses/>.  
19 -#  
20 -# ==========================================================================  
21 -  
22 -#  
23 -# Run the examples test  
24 -# =====================  
25 -@PYTHON_COVERAGE@./test_examples.py