MCPcopy
hub / github.com/deadc0de6/dotdrop / create_fake_config

Function create_fake_config

tests/helpers.py:211–236  ·  view source on GitHub ↗

Create a fake config file

(directory, configname='config.yaml',
                       dotpath='dotfiles', backup=True, create=True,
                       import_configs=(), import_actions=(),
                       import_variables=())

Source from the content-addressed store, hash-verified

209
210
211def create_fake_config(directory, configname='config.yaml',
212 dotpath='dotfiles', backup=True, create=True,
213 import_configs=(), import_actions=(),
214 import_variables=()):
215 """Create a fake config file"""
216 path = os.path.join(directory, configname)
217 workdir = os.path.join(directory, 'workdir')
218 with open(path, 'w', encoding='utf-8') as file:
219 file.write('config:\n')
220 file.write(f' backup: {backup}\n')
221 file.write(f' create: {create}\n')
222 file.write(f' dotpath: {dotpath}\n')
223 file.write(f' workdir: {workdir}\n')
224 if import_actions:
225 file.write(' import_actions:\n')
226 file.write(yaml_dashed_list(import_actions, 4))
227 if import_configs:
228 file.write(' import_configs:\n')
229 file.write(yaml_dashed_list(import_configs, 4))
230 if import_variables:
231 file.write(' import_variables:\n')
232 file.write(yaml_dashed_list(import_variables, 4))
233 file.write('dotfiles:\n')
234 file.write('profiles:\n')
235 file.write('actions:\n')
236 return path
237
238
239def create_yaml_keyval(pairs, parent_dir=None, top_key=None):

Callers 14

test_updateMethod · 0.90
test_listingsMethod · 0.90
test_compareMethod · 0.90
test_importMethod · 0.90
test_configMethod · 0.90
test_resolve_linkMethod · 0.90
test_includeMethod · 0.90

Calls 1

yaml_dashed_listFunction · 0.85

Tested by 14

test_updateMethod · 0.72
test_listingsMethod · 0.72
test_compareMethod · 0.72
test_importMethod · 0.72
test_configMethod · 0.72
test_resolve_linkMethod · 0.72
test_includeMethod · 0.72