Coverage for tests/test_getPackageDir.py : 54%

Hot-keys 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
1#
2# Developed for the LSST Data Management System.
3# This product includes software developed by the LSST Project
4# (https://www.lsst.org).
5# See the COPYRIGHT file at the top-level directory of this distribution
6# for details of code ownership.
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <https://www.gnu.org/licenses/>.
20#
22import sys
23import os
24import unittest
26import lsst.utils.tests
27from lsst.utils import getPackageDir
30class GetPackageDirTestCase(unittest.TestCase):
31 def testBasics(self):
32 utilsPath = getPackageDir("utils")
33 self.assertTrue(os.path.isfile(os.path.join(utilsPath, "tests", "test_getPackageDir.py")))
35 # Confirm that we have a correct Python exception and pex exception
36 with self.assertRaises(LookupError) as cm:
37 getPackageDir("nameOfNonexistendPackage2234q?#!")
39 # Deliberately do not import pex_exceptions so as not to bias the
40 # tests. Check for the name instead.
41 self.assertIn("NotFoundError", type(cm.exception).__name__)
43 def testUnicodeBasics(self):
44 utilsPath = getPackageDir(u"utils")
45 self.assertTrue(os.path.isfile(os.path.join(utilsPath, "tests", "test_getPackageDir.py")))
48class TestMemory(lsst.utils.tests.MemoryTestCase):
49 pass
52def setup_module(module):
53 lsst.utils.tests.init()
56if __name__ == "__main__": 56 ↛ 57line 56 didn't jump to line 57, because the condition on line 56 was never true
57 setup_module(sys.modules[__name__])
58 unittest.main()