Coverage for tests / test_dagIdInfo.py: 39%
31 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-17 09:09 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-17 09:09 +0000
1#
2# LSST Data Management System
3# Copyright 2008-2012 LSST Corporation.
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#
23import os
24import sys
25import unittest
26from subprocess import PIPE, Popen
28import lsst.utils.tests
31def setup_module(module):
32 lsst.utils.tests.init()
35class TestDagIdInfo(lsst.utils.tests.TestCase):
36 def executeCommand(self, cmd):
37 p = Popen(cmd.split(), stdout=PIPE, stderr=PIPE)
38 stdout, stderr = p.communicate()
39 stdout = stdout.decode()
40 return stdout
42 def test1(self):
43 exe = sys.executable
44 execPath = "lsst.ctrl.execute.libexec.dagIdInfo"
45 filename = os.path.join("tests", "testfiles", "test.diamond.dag")
47 stdout = self.executeCommand(f"{exe} -m {execPath} A1 {filename}")
48 self.assertEqual(stdout, "run=1033 filter=r camcol=2 field=229\n")
50 stdout = self.executeCommand(f"{exe} -m {execPath} A3 {filename}")
51 self.assertEqual(stdout, "run=1033 filter=i camcol=2 field=47\n")
53 stdout = self.executeCommand(f"{exe} -m {execPath} A17 {filename}")
54 val = "run=1033 filter=r camcol=2 field=229 run=1033 filter=i camcol=2 field=47\n"
55 self.assertEqual(stdout, val)
57 stdout = self.executeCommand(f"{exe} -m {execPath} B1 {filename}")
58 self.assertEqual(stdout, "")
61class TestDagInfoMemoryTest(lsst.utils.tests.MemoryTestCase):
62 pass
65if __name__ == "__main__": 65 ↛ 66line 65 didn't jump to line 66 because the condition on line 65 was never true
66 lsst.utils.tests.init()
67 unittest.main()