Coverage for tests/test_drivers.py: 59%

Shortcuts 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

23 statements  

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 

33 def setUp(self): 

34 self.cwd = os.getcwd() 

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

36 

37 def tearDown(self): 

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

39 

40 def testDeprecatedOutCollection(self): 

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

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

43 

44 def testMissingOutputRun(self): 

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

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

47 

48 def testMissingSubmitPath(self): 

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

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

51 

52 

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

54 unittest.main()