Hide keyboard shortcuts

Hot-keys 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

1# 

2# Developed for the LSST Data Management System. 

3# This product includes software developed by the LSST Project 

4# (https://www.lsst.org). 

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

6# for details of code ownership. 

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 GNU General Public License 

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

20# 

21 

22import os 

23import sys 

24import unittest 

25import subprocess 

26 

27import lsst.utils.tests 

28from lsst.utils import backtrace 

29 

30ROOT = os.path.abspath(os.path.dirname(__file__)) 

31 

32 

33class BacktraceTestCase(lsst.utils.tests.TestCase): 

34 def setUp(self): 

35 pass 

36 

37 def test_segfault(self): 

38 if backtrace.isEnabled(): 

39 with self.assertRaises(subprocess.CalledProcessError) as cm: 

40 subprocess.check_output([sys.executable, os.path.join(ROOT, "backtrace.py")], 

41 stderr=subprocess.STDOUT) 

42 

43 output = cm.exception.output.decode() 

44 print(output) 

45 self.assertIn("backtrace follows", output) 

46 

47 

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

49 pass 

50 

51 

52def setup_module(module): 

53 lsst.utils.tests.init() 

54 

55 

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

57 setup_module(sys.modules[__name__]) 

58 unittest.main()