Coverage for tests/test_pipelines.py: 41%

27 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-04-02 03:09 -0700

1# This file is part of ap_pipe. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (http://www.lsst.org). 

6# See the COPYRIGHT file at the top-level directory of this distribution 

7# for details of code ownership. 

8# 

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

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

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

12# (at your option) any later version. 

13# 

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

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

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

17# GNU General Public License for more details. 

18# 

19# You should have received a copy of the GNU General Public License 

20# along with this program. If not, see <http://www.gnu.org/licenses/>. 

21 

22import glob 

23import os.path 

24import unittest 

25 

26# need to import pyproj to prevent file handle leakage 

27import pyproj # noqa: F401 

28 

29import lsst.pipe.base 

30import lsst.utils 

31import lsst.utils.tests 

32 

33 

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

35 """Tests of the self-consistency of our pipeline definitions. 

36 """ 

37 def setUp(self): 

38 self.path = os.path.join(lsst.utils.getPackageDir("ap_pipe"), "pipelines") 

39 

40 def test_pipelines(self): 

41 """Test that each pipeline definition file in `_ingredients/` can be 

42 used to build a graph. 

43 """ 

44 files = glob.glob(os.path.join(self.path, "_ingredients/*.yaml")) 

45 for file in files: 

46 if "ApTemplate" in file: 

47 # Our ApTemplate definition cannot be tested here because it 

48 # depends on drp_tasks, which we cannot make a dependency here. 

49 continue 

50 with self.subTest(file): 

51 pipeline = lsst.pipe.base.Pipeline.from_uri(file) 

52 if "apPipe" in pipeline.subsets: 

53 pipeline.addConfigOverride("diaPipe", "apdb.db_url", "sqlite://") 

54 # If this fails, it will produce a useful error message. 

55 pipeline.to_graph() 

56 

57 

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

59 pass 

60 

61 

62def setup_module(module): 

63 lsst.utils.tests.init() 

64 

65 

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

67 lsst.utils.tests.init() 

68 unittest.main()