def test_from_pyfile(self): """Config is loaded from Python file""" dirname = os.path.dirname(__file__) path = os.path.join(dirname, 'config.py') config = Config() config.from_pyfile(path) self.assertEqual(config.WORKER_MAX_LOAD, 20)
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) 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_pyfile(self): dirname = os.path.dirname(__file__) path = os.path.join(dirname, 'config.py') config = Config() config.from_pyfile(path) self.assertEqual(config.MAX_LOAD, 20)