Example #1
0
class SomeClass(object):

    max = staticconf.get_int('SomeClass.max')
    min = staticconf.get_int('SomeClass.min')
    ratio = staticconf.get_float('SomeClass.ratio')
    alt_ratio = staticconf.get_float('SomeClass.alt_ratio', 6.0)
    msg = staticconf.get_string('SomeClass.msg', None)

    real_max = staticconf.get_int('SomeClass.max', namespace='real')
    real_min = staticconf.get_int('SomeClass.min', namespace='real')
class SomeClass(object):

    namespace = 'UniqueNamespaceForEndToEndTesting'
    alt_name = 'UniqueNamespaceForEndToEndTestingAlternative'

    getters = staticconf.NamespaceGetters(namespace)
    max = getters.get_int('SomeClass.max')
    min = getters.get_int('SomeClass.min')
    ratio = getters.get_float('SomeClass.ratio')
    alt_ratio = getters.get_float('SomeClass.alt_ratio', 6.0)
    msg = getters.get_string('SomeClass.msg', None)

    real_max = staticconf.get_int('SomeClass.max', namespace=alt_name)
    real_min = staticconf.get_int('SomeClass.min', namespace=alt_name)
Example #3
0
 def __init__(self, queue_name, msg_class=JSONMessage):
     self._num_messages_to_fetch = staticconf.get_int(
         'sqs.num_messages_per_fetch', 1
     )
     self._wait_time_secs = staticconf.get_int(
         'sqs.wait_time_secs', 10
     )
     self._queue = self._get_queue(queue_name)
     if self._queue is None:
         raise ValueError(
             "Queue not found, for queue name:" + queue_name)
     self.msg_class = msg_class
     self._queue.set_message_class(self.msg_class)
     self.queue_name = queue_name
     self.attributes = self._queue.get_attributes()
Example #4
0
    def test_mock_configuration_context_manager(self):
        one = staticconf.get('one')
        three = staticconf.get_int('three', default=3)

        with testing.MockConfiguration(dict(one=7)):
            assert_equal(one, 7)
            assert_equal(three, 3)
        assert_raises(errors.ConfigurationError, staticconf.get('one'))
 def test_validate_single_fails(self):
     _ = staticconf.get_int('one.two')
     assert_raises(errors.ConfigurationError, config.validate)
 def test_validate_single_fails(self):
     _ = staticconf.get_int('one.two')
     assert_raises(errors.ConfigurationError, config.validate)
# -*- coding: utf-8 -*-
from __future__ import absolute_import

import staticconf

address = staticconf.get_string('address', "")
port = staticconf.get_int('port', 8123)
db_uri = staticconf.get_string('db_uri')
template_path = staticconf.get_string('template_path', "templates")
debug = staticconf.get_bool('debug', False)

def load(path):
	staticconf.YamlConfiguration(path, error_on_unknown=True)