Coverage for tests/test_executables.py: 38%
15 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-25 09:27 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-07-25 09:27 +0000
1# This file is part of utils.
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# Use of this source code is governed by a 3-clause BSD-style
10# license that can be found in the LICENSE file.
12import os
13import unittest
15import lsst.utils.tests
18class ExplicitBinaryTester(lsst.utils.tests.ExecutablesTestCase):
19 """Test that a named executable can be run."""
21 def testSimpleExe(self):
22 """Test explicit shell script"""
23 self.assertExecutable(
24 "testexe.sh", root_dir=os.path.dirname(__file__), args=["-h"], msg="testexe.sh failed"
25 )
27 # Try a non-existent test
28 with self.assertRaises(unittest.SkipTest):
29 self.assertExecutable("testexe-missing.sh")
31 # Force test to fail, explicit fail message
32 with self.assertRaises(AssertionError):
33 self.assertExecutable(
34 "testexe.sh", root_dir=os.path.dirname(__file__), args=["-f"], msg="testexe.sh failed"
35 )
37 # Force script to fail, default fail message
38 with self.assertRaises(AssertionError):
39 self.assertExecutable("testexe.sh", root_dir=os.path.dirname(__file__), args=["-f"])
42class UtilsBinaryTester(lsst.utils.tests.ExecutablesTestCase):
43 """Run test binaries in this package."""
46EXECUTABLES = None
47UtilsBinaryTester.create_executable_tests(__file__, EXECUTABLES)
49if __name__ == "__main__":
50 unittest.main()