Coverage for tests/test_executables.py: 50%

18 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2022-09-11 01:01 -0700

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. 

11 

12import os 

13import unittest 

14 

15import lsst.utils.tests 

16 

17 

18class ExplicitBinaryTester(lsst.utils.tests.ExecutablesTestCase): 

19 def testSimpleExe(self): 

20 """Test explicit shell script""" 

21 self.assertExecutable( 

22 "testexe.sh", root_dir=os.path.dirname(__file__), args=["-h"], msg="testexe.sh failed" 

23 ) 

24 

25 # Try a non-existent test 

26 with self.assertRaises(unittest.SkipTest): 

27 self.assertExecutable("testexe-missing.sh") 

28 

29 # Force test to fail, explicit fail message 

30 with self.assertRaises(AssertionError): 

31 self.assertExecutable( 

32 "testexe.sh", root_dir=os.path.dirname(__file__), args=["-f"], msg="testexe.sh failed" 

33 ) 

34 

35 # Force script to fail, default fail message 

36 with self.assertRaises(AssertionError): 

37 self.assertExecutable("testexe.sh", root_dir=os.path.dirname(__file__), args=["-f"]) 

38 

39 

40class UtilsBinaryTester(lsst.utils.tests.ExecutablesTestCase): 

41 pass 

42 

43 

44EXECUTABLES = None 

45UtilsBinaryTester.create_executable_tests(__file__, EXECUTABLES) 

46 

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

48 unittest.main()