Coverage for tests/test_drivers.py: 48%

23 statements  

« prev     ^ index     » next       coverage.py v6.4.1, created at 2022-06-18 10:45 +0000

1# This file is part of ctrl_bps. 

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/>. 

21import os 

22import shutil 

23import tempfile 

24import unittest 

25 

26from lsst.ctrl.bps.drivers import _init_submission_driver 

27 

28TESTDIR = os.path.abspath(os.path.dirname(__file__)) 

29 

30 

31class TestInitSubmissionDriver(unittest.TestCase): 

32 def setUp(self): 

33 self.cwd = os.getcwd() 

34 self.tmpdir = tempfile.mkdtemp(dir=TESTDIR) 

35 

36 def tearDown(self): 

37 shutil.rmtree(self.tmpdir, ignore_errors=True) 

38 

39 def testDeprecatedOutCollection(self): 

40 with self.assertRaisesRegex(KeyError, "outCollection"): 

41 _init_submission_driver({"payload": {"outCollection": "bad"}}) 

42 

43 def testMissingOutputRun(self): 

44 with self.assertRaisesRegex(KeyError, "outputRun"): 

45 _init_submission_driver({"payload": {"inCollection": "bad"}}) 

46 

47 def testMissingSubmitPath(self): 

48 with self.assertRaisesRegex(KeyError, "submitPath"): 

49 _init_submission_driver({"payload": {"outputRun": "bad"}}) 

50 

51 

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

53 unittest.main()