def get_state_manager_from_config(config_path, working_dir): """Return a state manager from the configuration. """ config_manager = manager.ConfigManager(config_path) config_container = config_manager.load() state_config = config_container.get_master().state_persistence with tool_utils.working_dir(working_dir): return PersistenceManagerFactory.from_config(state_config)
def main(config_path, working_dir): container = get_container(config_path) config = container.get_master().state_persistence with tool_utils.working_dir(working_dir): display_report(config, *get_state(container))
def test_working_dir_nested(self): with tool_utils.working_dir(self.temp_dir): with tool_utils.working_dir(self.second_dir): assert_equal(os.getcwd(), self.second_dir) assert_equal(os.getcwd(), self.temp_dir) assert_equal(os.getcwd(), self.cwd)
def with_exc(): with tool_utils.working_dir(self.temp_dir): assert_equal(os.getcwd(), self.temp_dir) raise Exception("oops")