예제 #1
0
if (kvf.read() < 0):
    sys.exit(-1)
if kvf.check(mandatory_keys) != 0:
    sys.exit(-1)

# set defaults
defaults = {}
spr2root = kvf.get('Springhead2')
defaults['UnityProject'] = spr2root + '/src/Unity'
defaults['TestRoot'] = spr2root + '/src/UnityTest'
defaults['IniFile'] = defaults['TestRoot'] + '/UnityTest.ini'
defaults['ScenesDir'] = 'Assets/Scenes'
defaults['TestMainLogFile'] = defaults['TestRoot'] + '/log/TestMain.log'
for key in defaults.keys():
    if kvf.get(key) is None:
        kvf.set(key, defaults[key])
if options.verbose:
    print('  ------------------------------------------------')
    for key in sorted(mandatory_keys):
        print('  %s:\t%s' % (key, kvf.get(key)))
    print('  ------------------------------------------------')
    for key in sorted(defaults.keys()):
        print('  %s:\t%s' % (key, kvf.get(key)))

# ----------------------------------------------------------------------
#  Execute 'UnityTestScript' for all scenes in 'SecneList'
#
scenes_dir = kvf.get('ScenesDir')
scene_list = kvf.get('SceneList')
if options.verbose:
    print('  scenes_dir:\t%s' % (scenes_dir))
예제 #2
0
##
fname = 'test/KvFileTest.ini3'
print('-- %s --' % fname)
kvf = KvFile(fname, overwrite=False, verbose=verbose)
count = kvf.read()
if count < 0:
    Print(kvf.error())
    sys.exit(-1)
Print('file: "%s"' % fname)
Print(defined_sections(count, kvf))
Print('----')
kvf.show(2)
print()

print('-- set(aux_def, aux_val_def) --')
kvf.set('aux_def', 'aux_val_def')
print('-- set(aux_sec1, aux_val_sec1, section1) --')
kvf.set('aux_sec1', 'aux_val_sec1', 'section1')
print('-- set(aux_sec2, aux_val_sec2, section2) --')
kvf.set('aux_sec2', 'aux_val_sec2', 'section2')
print()

print('-- get(KvFile.DEFAULT) --')
kvf.show(2, KvFile.DEFAULT)
print()
sections = kvf.sections()
for s in sections:
    print('-- get(%s) --' % s)
    kvf.show(2, s)
    print()