Coverage for python/lsst/ctrl/execute/condorInfoConfig.py: 60%
21 statements
« prev ^ index » next coverage.py v7.2.1, created at 2023-03-12 01:44 -0800
« prev ^ index » next coverage.py v7.2.1, created at 2023-03-12 01:44 -0800
1#!/usr/bin/env python
3#
4# LSST Data Management System
5# Copyright 2008-2016 LSST Corporation.
6#
7# This product includes software developed by the
8# LSST Project (http://www.lsst.org/).
9#
10# This program is free software: you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the LSST License Statement and
21# the GNU General Public License along with this program. If not,
22# see <http://www.lsstcorp.org/LegalNotices/>.
23#
25import lsst.pex.config as pexConfig
26from lsst.ctrl.execute import envString
29class FakeTypeMap(dict):
31 def __init__(self, configClass):
32 self.configClass = configClass
34 def __getitem__(self, k):
35 return self.setdefault(k, self.configClass)
38class UserInfoConfig(pexConfig.Config):
39 """ User information
40 """
41 name = pexConfig.Field(doc="user login name", dtype=str, default=None)
42 home = pexConfig.Field(doc="user home directory", dtype=str, default=None)
45class UserConfig(pexConfig.Config):
46 """ User specific information
47 """
48 user = pexConfig.ConfigField(doc="user", dtype=UserInfoConfig)
51class CondorInfoConfig(pexConfig.Config):
52 """A pex_config file describing the platform specific information about
53 remote user logins.
54 """
55 platform = pexConfig.ConfigChoiceField("platform info", FakeTypeMap(UserConfig))
58if __name__ == "__main__": 58 ↛ 59line 58 didn't jump to line 59, because the condition on line 58 was never true
59 config = CondorInfoConfig()
60 filename = "$HOME/.lsst/condor-info.py"
61 filename = envString.resolve(filename)
62 config.load(filename)
64 for i in config.platform:
65 print(i)