Coverage for tests/test_dagIdInfo.py: 39%
31 statements
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-05 03:20 -0700
« prev ^ index » next coverage.py v7.4.4, created at 2024-04-05 03:20 -0700
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 = os.path.join("bin.src", "dagIdInfo.py")
45 filename = os.path.join("tests", "testfiles", "test.diamond.dag")
47 stdout = self.executeCommand("%s %s A1 %s" % (exe, execPath, filename))
48 self.assertEqual(stdout, "run=1033 filter=r camcol=2 field=229\n")
50 stdout = self.executeCommand("%s %s A3 %s" % (exe, execPath, filename))
51 self.assertEqual(stdout, "run=1033 filter=i camcol=2 field=47\n")
53 stdout = self.executeCommand("%s %s A17 %s" % (exe, execPath, filename))
54 val = (
55 "run=1033 filter=r camcol=2 field=229 run=1033 filter=i camcol=2 field=47\n"
56 )
57 self.assertEqual(stdout, val)
59 stdout = self.executeCommand("%s %s B1 %s" % (exe, execPath, filename))
60 self.assertEqual(stdout, "")
63class TestDagInfoMemoryTest(lsst.utils.tests.MemoryTestCase):
64 pass
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()