コード例 #1
0
 def setUpClass(cls):
     conf = LunrConfig.from_api_conf()
     sess = db.configure(conf)
     # Change the min_size to 0, so we can
     # create volumes smaller than a gig
     query = sess.query(VolumeType).filter_by(name='vtype')
     # Save the original value
     cls._min_size = query.one().min_size
     # Set min_size to 0
     query.update({'min_size': 0})
     sess.commit()
コード例 #2
0
ファイル: test_backup.py プロジェクト: pombredanne/lunr
 def setUpClass(cls):
     conf = LunrConfig.from_api_conf()
     sess = db.configure(conf)
     # Change the min_size to 0, so we can
     # create volumes smaller than a gig
     query = sess.query(VolumeType).filter_by(name='vtype')
     # Save the original value
     cls._min_size = query.one().min_size
     # Set min_size to 0
     query.update({'min_size': 0})
     sess.commit()
コード例 #3
0
ファイル: test_config.py プロジェクト: rackerlabs/lunr
 def test_from_api_conf(self):
     conf_str = dedent("""
         [DEFAULT]
         foo = bar
         """)
     with temp_disk_file(conf_str) as file:
         with patch(LunrConfig, 'lunr_api_config', file):
             conf = LunrConfig.from_api_conf()
             self.assertEquals(conf.lunr_api_config, file)
             self.assertEquals(conf.string('default', '__file__', ''),
                               conf.lunr_api_config)
             self.assertEquals(conf.string('default', 'foo', ''), 'bar')
コード例 #4
0
ファイル: test_config.py プロジェクト: pombredanne/lunr
 def test_from_api_conf(self):
     conf_str = dedent(
         """
         [DEFAULT]
         foo = bar
         """
     )
     with temp_disk_file(conf_str) as file:
         with patch(LunrConfig, 'lunr_api_config', file):
             conf = LunrConfig.from_api_conf()
             self.assertEquals(conf.lunr_api_config, file)
             self.assertEquals(conf.string('default', '__file__', ''),
                               conf.lunr_api_config)
             self.assertEquals(conf.string('default', 'foo', ''), 'bar')
コード例 #5
0
ファイル: console.py プロジェクト: audip/lunr
            InteractiveConsole.__init__(self, locals=locals)

        def __call__(self):
            return self.interact(banner=self.banner)


def load_conf(options, args):
    if options.config:
        try:
            conf = LunrConfig.from_conf(options.config)
        except IOError, e:
            print 'Error: %s' % e
            sys.exit(1)
    else:
        try:
            conf = LunrConfig.from_api_conf()
        except IOError, e:
            conf = LunrConfig()
            print 'Warning: %s' % e

    if options.verbose:
        conf.set('db', 'echo', options.verbose)
    if args:
        conf.set('db', 'url', args[0])
    return conf


def main():
    parser = OptionParser('%prog [options] [DB_URL]')
    parser.add_option('-v', '--verbose', action='store_true',
                      help='make sqlalchemy noisy')
コード例 #6
0
            InteractiveConsole.__init__(self, locals=locals)

        def __call__(self):
            return self.interact(banner=self.banner)


def load_conf(options, args):
    if options.config:
        try:
            conf = LunrConfig.from_conf(options.config)
        except IOError, e:
            print 'Error: %s' % e
            sys.exit(1)
    else:
        try:
            conf = LunrConfig.from_api_conf()
        except IOError, e:
            conf = LunrConfig()
            print 'Warning: %s' % e

    if options.verbose:
        conf.set('db', 'echo', options.verbose)
    if args:
        conf.set('db', 'url', args[0])
    return conf


def main():
    parser = OptionParser('%prog [options] [DB_URL]')
    parser.add_option('-v',
                      '--verbose',