Coverage for tests/test_getPackageDir.py: 60%

22 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2022-08-27 02:19 -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 sys 

14import unittest 

15 

16import lsst.utils.tests 

17from lsst.utils import getPackageDir 

18 

19 

20@unittest.skipIf("UTILS_DIR" not in os.environ, "EUPS has not set up this package.") 

21class GetPackageDirTestCase(unittest.TestCase): 

22 def testBasics(self): 

23 utilsPath = getPackageDir("utils") 

24 self.assertTrue(os.path.isfile(os.path.join(utilsPath, "tests", "test_getPackageDir.py"))) 

25 

26 # Confirm that we have a correct Python exception and pex exception 

27 with self.assertRaises(LookupError): 

28 getPackageDir("nameOfNonexistendPackage2234q?#!") 

29 

30 def testUnicodeBasics(self): 

31 utilsPath = getPackageDir("utils") 

32 self.assertTrue(os.path.isfile(os.path.join(utilsPath, "tests", "test_getPackageDir.py"))) 

33 

34 

35class TestMemory(lsst.utils.tests.MemoryTestCase): 

36 pass 

37 

38 

39def setup_module(module): 

40 lsst.utils.tests.init() 

41 

42 

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

44 setup_module(sys.modules[__name__]) 

45 unittest.main()