Coverage for tests/test_dagIdInfo.py: 46%

Shortcuts on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

31 statements  

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# 

22 

23import os 

24import sys 

25import unittest 

26from subprocess import Popen, PIPE 

27import lsst.utils.tests 

28 

29 

30def setup_module(module): 

31 lsst.utils.tests.init() 

32 

33 

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

35 

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 

41 

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") 

46 

47 stdout = self.executeCommand("%s %s A1 %s" % (exe, execPath, filename)) 

48 self.assertEqual(stdout, 'run=1033 filter=r camcol=2 field=229\n') 

49 

50 stdout = self.executeCommand("%s %s A3 %s" % (exe, execPath, filename)) 

51 self.assertEqual(stdout, 'run=1033 filter=i camcol=2 field=47\n') 

52 

53 stdout = self.executeCommand("%s %s A17 %s" % (exe, execPath, 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) 

56 

57 stdout = self.executeCommand("%s %s B1 %s" % (exe, execPath, filename)) 

58 self.assertEqual(stdout, '') 

59 

60 

61class TestDagInfoMemoryTest(lsst.utils.tests.MemoryTestCase): 

62 pass 

63 

64 

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()