def create_config(args): """Creates Config object and overrides it's values from args.""" config = Config() if args.config: # Load config file from command line option config.from_pyfile(args.config) elif args.module: config.from_pymodule(args.module) else: # Load config file from environment variable env_config = os.environ.get('KUYRUK_CONFIG') if env_config: assert os.path.isabs(env_config) config.from_pyfile(env_config) config.from_env_vars() config.from_cmd_args(args) return config
def test_from_pymodule(self): """Config is loaded from Python module""" config = Config() config.from_pymodule('config2') self.assertEqual(config.WORKER_MAX_LOAD, 20)
def test_from_pymodule(self): config = Config() config.from_pymodule('config2') self.assertEqual(config.WORKER_MAX_LOAD, 20)