Coverage for tests/test_backtrace.py: 46%
18 statements
« prev ^ index » next coverage.py v7.5.3, created at 2024-06-05 23:41 -0700
« prev ^ index » next coverage.py v7.5.3, created at 2024-06-05 23:41 -0700
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#
22import os
23import sys
24import unittest
25import subprocess
27from lsst.cpputils import backtrace
29ROOT = os.path.abspath(os.path.dirname(__file__))
32class BacktraceTestCase(unittest.TestCase):
33 def setUp(self):
34 pass
36 def test_segfault(self):
37 if backtrace.isEnabled():
38 with self.assertRaises(subprocess.CalledProcessError) as cm:
39 subprocess.check_output([sys.executable, os.path.join(ROOT, "backtrace.py")],
40 stderr=subprocess.STDOUT)
42 output = cm.exception.output.decode()
43 print(output)
44 self.assertIn("backtrace follows", output)
47if __name__ == "__main__": 47 ↛ 48line 47 didn't jump to line 48, because the condition on line 47 was never true
48 unittest.main()