def test_settings_will_load_config_ini_retains_config(): clear_expectations() settings = Settings("some_dir") settings.load() assert settings.config
def test_settings_can_load_custom_file(): clear_expectations() settings = Settings("some_dir") settings.load("custom.ini") assert settings.config
def test_settings_read_file_that_does_not_exist_raises(): clear_expectations() settings = Settings("some_dir") try: settings.load() except ValueError, err: assert str(err).startswith("The specified path") assert str(err).endswith("was not found!") return
def run_skink_server(): signal.signal( signal.SIGHUP, SigHUPHandler ) root_dir = abspath(dirname(__file__)) server = Server(root_dir=root_dir) server.build_dir = join(root_dir, "ci_tmp") server.subscribe('on_user_authentication_failed', on_user_authentication_failed_handler) server.context.current_project = None server.context.current_command = None server.context.current_log = "" server.context.build_queue = Queue.deque() server.context.projects_being_built = Queue.deque() builder = BuilderPlugin(cherrypy.engine, server) builder.subscribe() monitor = MonitorPlugin(cherrypy.engine, server) monitor.subscribe() settings = Settings(root_dir) settings.load("config.ini") pid_file = settings.Ion.pid_file pid = cherrypy.process.plugins.PIDFile(cherrypy.engine, pid_file) pid.subscribe() try: server.start("config.ini", non_block=True) for plugin in SkinkPlugin.all(): config = server.context.settings.config if config.has_section(plugin.__name__) and \ config.get(plugin.__name__, "enabled") == "True": cherrypy.log('Plugin %s enabled!' % plugin.__name__, 'PLUGINS') instance = plugin(server) cherrypy.engine.block() except KeyboardInterrupt: server.stop()
def run_migrations(drop_db=False): root_dir = abspath(dirname(__file__)) settings = Settings(root_dir) settings.load("config.ini") protocol = settings.Db.protocol username = settings.Db.user password = settings.Db.password host = settings.Db.host port = int(settings.Db.port) database = settings.Db.database config = InPlaceConfig(db_host=host, db_user=username, db_password=password, db_name=database, migrations_dir=join(root_dir, "db")) config.put("schema_version", None) config.put("show_sql", False) config.put("show_sql_only", False) config.put("new_migration", None) config.put("drop_db_first", drop_db) Main(config).execute()
def test_settings_will_load_config_ini(): clear_expectations() settings = Settings("some_dir") settings.load()
def test_settings_read_attribute_returns_config_read(): clear_expectations() settings = Settings("some_dir") settings.load() assert settings.SomeSection.SomeAttribute == "attribute_value"