Coverage for tests/test_config.py: 62%

24 statements  

« prev     ^ index     » next       coverage.py v6.4.2, created at 2022-07-19 05:45 -0700

1# 

2# LSST Data Management System 

3# Copyright 2008-2017 AURA/LSST. 

4# 

5# This product includes software developed by the 

6# LSST Project (http://www.lsst.org/). 

7# 

8# This program is free software: you can redistribute it and/or modify 

9# it under the terms of the GNU General Public License as published by 

10# the Free Software Foundation, either version 3 of the License, or 

11# (at your option) any later version. 

12# 

13# This program is distributed in the hope that it will be useful, 

14# but WITHOUT ANY WARRANTY; without even the implied warranty of 

15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

16# GNU General Public License for more details. 

17# 

18# You should have received a copy of the LSST License Statement and 

19# the GNU General Public License along with this program. If not, 

20# see <http://www.lsstcorp.org/LegalNotices/>. 

21# 

22 

23import os 

24import unittest 

25import lsst.utils.tests 

26 

27from lsst.pipe.tasks.makeSkyMap import MakeSkyMapConfig 

28from lsst.pipe.tasks.multiBand import MergeDetectionsConfig 

29from lsst.pipe.tasks.multiBand import MergeMeasurementsConfig 

30from lsst.pipe.tasks.processCcd import ProcessCcdConfig 

31from lsst.utils import getPackageDir 

32 

33 

34class ConfigOverrideTestCase(lsst.utils.tests.TestCase): 

35 """Test that config overrides apply without error.""" 

36 CONFIG_DIR = os.path.join(getPackageDir("obs_cfht"), "config") 

37 

38 def testOverrides(self): 

39 # Other config overrides at time of writing: 

40 # 

41 # colorterms.py: Tested implicitly in processCcd.py 

42 # singleFrameDriver.py: Requires pipe_drivers, which is not a 

43 # dependency of this package. 

44 for configClass, overrideFilename in { 

45 MakeSkyMapConfig: "makeSkyMap.py", 

46 MergeDetectionsConfig: "mergeCoaddDetections.py", 

47 MergeMeasurementsConfig: "mergeCoaddMeasurements.py", 

48 ProcessCcdConfig: "processCcd.py" 

49 }.items(): 

50 config = configClass() 

51 try: 

52 config.load(os.path.join(self.CONFIG_DIR, overrideFilename)) 

53 except AttributeError as e: 

54 # A failure to load configuration is a test failure, not an 

55 # error, so we convert the exception appropriately. 

56 self.fail(e) 

57 

58 

59def setup_module(module): 

60 lsst.utils.tests.init() 

61 

62 

63class MemoryTester(lsst.utils.tests.MemoryTestCase): 

64 pass 

65 

66 

67if __name__ == "__main__": 67 ↛ 68line 67 didn't jump to line 68, because the condition on line 67 was never true

68 lsst.utils.tests.init() 

69 unittest.main()