Exemplo n.º 1
0
 def setup(self):
     self.defaults = {
         'type': 'movie',
         'person': {
             'name': 'P.T. Anderson',
             'job': 'Director'
         }
     }
     self.config = Config(defaults=self.defaults)
Exemplo n.º 2
0
def test_init():
    # Test lazy loading (not pointing to a config file)
    config = Config()
    assert config.markup is json

    # Test loading with some defaults
    config = Config(defaults=dict(name='P.T. Anderson'))
    assert config['name'] == 'P.T. Anderson'

    # Test loading with an alternate markup engine
    config = Config(markup=toml)
    assert config.markup is toml

    # Test loading with a non-existent config file
    config = Config(LazyFile('tests/fixtures/nothing.json', 'w'))
    assert config == {}

    # Test loading with an existing config file
    config = Config(LazyFile('tests/fixtures/something.json', 'w'))
    assert config['title'] == 'Magnolia'
Exemplo n.º 3
0
def root(context, config, database, verbose, log_file):
    """Clinical sequencing coverage analysis tool."""
    # setup logging
    loglevel = LEVELS.get(min(verbose, 2), 'WARNING')
    init_log(logging.getLogger(), loglevel=loglevel, filename=log_file)
    logger.info("version {0}".format(__version__))

    # avoid setting global defaults in Click options, do it below when
    # updating the config object
    context.obj = Config(config, markup=markup)
    context.obj['database'] = (database or context.obj.get(
        'database', 'coverage.sqlite3'))

    # update the context with new defaults from the config file
    context.default_map = context.obj