Beispiel #1
0
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
An empty config file should successfully yield an empty sparse config dict.
"""


import os, sys

fpath = os.path.dirname(os.path.abspath(__file__))
# parsec
sys.path.append(fpath + '/../../..')


from parsec.config import ParsecConfig
from parsec.validate import ParsecValidator as VDR
from parsec.OrderedDict import OrderedDict

SPEC = {'meta': {'title': [VDR.V_STRING]}}
cfg = ParsecConfig(SPEC)
cfg.loadcfg("empty.rc")

if cfg.get(sparse=True) != OrderedDict():
    sys.exit(1)
Beispiel #2
0
 def __init__(self, fpath, output_fname, tvars):
     """Return the default instance."""
     ParsecConfig.__init__(self, SPEC, upg, output_fname, tvars,
                           cylc_config_validate)
     self.loadcfg(fpath, "suite definition")
Beispiel #3
0
 def __init__(self, spec, upg):
     ParsecConfig.__init__(self, spec, upg, validator=cylc_config_validate)
     self.default_theme = None
     self.use_theme = None
Beispiel #4
0
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
An empty config file should successfully yield an empty sparse config dict.
"""


import os
import sys

from parsec.config import ParsecConfig
from parsec.validate import ParsecValidator as VDR
from parsec.OrderedDict import OrderedDict

fpath = os.path.dirname(os.path.abspath(__file__))
# parsec
sys.path.append(fpath + '/../../..')

SPEC = {'meta': {'title': [VDR.V_STRING]}}
cfg = ParsecConfig(SPEC)
cfg.loadcfg("empty.rc")

if cfg.get(sparse=True) != OrderedDict():
    sys.exit(1)
Beispiel #5
0
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Check that single-line config print works"""

import os
import sys

fpath = os.path.dirname(os.path.abspath(__file__))
# parsec
sys.path.append(fpath + '/../../..')

from parsec.config import ParsecConfig
from parsec.validate import ParsecValidator as VDR

SPEC = {'foo': {'bar': {'__MANY__': [VDR.V_STRING]}}}
cfg = ParsecConfig(SPEC)
cfg.loadcfg("test.rc")

cfg.mdump([['foo', 'bar', 'baz'], ['foo', 'bar', 'qux']],
          oneline=True,
          sparse=True)
Beispiel #6
0
 def __init__(self, fpath, output_fname, tvars):
     """Return the default instance."""
     ParsecConfig.__init__(
         self, SPEC, upg, output_fname, tvars, cylc_config_validate)
     self.loadcfg(fpath, "suite definition")
Beispiel #7
0
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Check that single-line config print works"""

import os
import sys

fpath = os.path.dirname(os.path.abspath(__file__))
# parsec
sys.path.append(fpath + '/../../..')


from parsec.config import ParsecConfig
from parsec.validate import ParsecValidator as VDR

SPEC = {'foo': {'bar': {'__MANY__': [VDR.V_STRING]}}}
cfg = ParsecConfig(SPEC)
cfg.loadcfg("test.rc")

cfg.mdump(
    [['foo', 'bar', 'baz'], ['foo', 'bar', 'qux']], oneline=True, sparse=True)