Coverage for tests/test_animation.py: 48%

29 statements  

« prev     ^ index     » next       coverage.py v7.2.5, created at 2023-05-10 03:21 -0700

1# This file is part of summit_extras. 

2# 

3# Developed for the LSST Data Management System. 

4# This product includes software developed by the LSST Project 

5# (https://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 <https://www.gnu.org/licenses/>. 

21 

22import unittest 

23import tempfile 

24import os 

25 

26import lsst.utils.tests 

27 

28from lsst.summit.extras.animation import Animator 

29from lsst.summit.utils.butlerUtils import makeDefaultLatissButler 

30 

31 

32class AnimationTestCase(lsst.utils.tests.TestCase): 

33 

34 @classmethod 

35 def setUpClass(cls): 

36 try: 

37 cls.butler = makeDefaultLatissButler() 

38 except FileNotFoundError: 

39 raise unittest.SkipTest("Skipping tests that require the LATISS butler repo.") 

40 

41 cls.dataIds = [{'day_obs': 20200315, 'seq_num': 120, 'detector': 0}, 

42 {'day_obs': 20200315, 'seq_num': 121, 'detector': 0}] 

43 cls.outputDir = tempfile.mkdtemp() 

44 cls.outputFilename = os.path.join(cls.outputDir, 'testAnimation.mp4') 

45 

46 def test_animation(self): 

47 """Test that the animator produces a large file without worrying about 

48 the contents? 

49 """ 

50 animator = Animator(self.butler, self.dataIds, self.outputDir, self.outputFilename, 

51 dataProductToPlot='raw', 

52 remakePngs=True, 

53 debug=False, 

54 clobberVideoAndGif=True, 

55 plotObjectCentroids=True, 

56 useQfmForCentroids=True) 

57 writtenFilename = animator.run() 

58 

59 self.assertTrue(writtenFilename == self.outputFilename) 

60 self.assertTrue(os.path.isfile(self.outputFilename)) 

61 self.assertTrue(os.path.getsize(self.outputFilename) > 10000) 

62 

63 

64class TestMemory(lsst.utils.tests.MemoryTestCase): 

65 pass 

66 

67 

68def setup_module(module): 

69 lsst.utils.tests.init() 

70 

71 

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

73 lsst.utils.tests.init() 

74 unittest.main()