def test_projects_ini_save_config_invalid_name(temp_dir): """Destination must follow file naming conventions """ k = project_ini.load_config('tests/data/project_ini/project.ini') with pytest.raises(ValueError): project_ini.save_config(k, filename=os.path.join(temp_dir, 'invald.ini'))
def take_action(self, parsed_args): ini_doc = generate_template_ini() created = [] exceptions = [] try: save_config(ini_doc, parsed_args.ini_file_name) created.append(parsed_args.ini_file_name) except Exception as e: exceptions.append(e) headers = ['created', 'messages'] data = [created, [str(e) for e in exceptions]] return (tuple(headers), tuple(data))
def test_projects_ini_save_config(temp_dir): """Ini file can be written to a named destination """ k = project_ini.load_config('tests/data/project_ini/project.ini') project_ini.save_config(k, filename=os.path.join(temp_dir, 'project.ini'))