Coverage for tests/test_config.py: 64%

25 statements  

« prev     ^ index     » next       coverage.py v6.4, created at 2022-05-24 03:30 -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.ingest import IngestConfig 

28from lsst.pipe.tasks.makeSkyMap import MakeSkyMapConfig 

29from lsst.pipe.tasks.multiBand import MergeDetectionsConfig 

30from lsst.pipe.tasks.multiBand import MergeMeasurementsConfig 

31from lsst.pipe.tasks.processCcd import ProcessCcdConfig 

32from lsst.utils import getPackageDir 

33 

34 

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

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

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

38 

39 def testOverrides(self): 

40 # Other config overrides at time of writing: 

41 # 

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

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

44 # dependency of this package. 

45 for configClass, overrideFilename in { 

46 IngestConfig: "ingest.py", 

47 MakeSkyMapConfig: "makeSkyMap.py", 

48 MergeDetectionsConfig: "mergeCoaddDetections.py", 

49 MergeMeasurementsConfig: "mergeCoaddMeasurements.py", 

50 ProcessCcdConfig: "processCcd.py" 

51 }.items(): 

52 config = configClass() 

53 try: 

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

55 except AttributeError as e: 

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

57 # error, so we convert the exception appropriately. 

58 self.fail(e) 

59 

60 

61def setup_module(module): 

62 lsst.utils.tests.init() 

63 

64 

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

66 pass 

67 

68 

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

70 lsst.utils.tests.init() 

71 unittest.main()