Esempio n. 1
0
if len(args) != 0:
    parser.error("incorrect number of arguments")

# Scene name
if options.verbose:
    print('  inifile:\t%s' % (options.inifile))

# ----------------------------------------------------------------------
#  Read init file
#
mandatory_keys = ['UnityTestScript', 'Python', 'Springhead2', 'SceneList']

kvf = KvFile(options.inifile)
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('  ------------------------------------------------')
Esempio n. 2
0
print('-- %s --' % fname)
kvf = KvFile(fname, 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()
#
keys = ['Springhead2', 'TestRoot', 'OutFile', 'SceneList']
Print('-- all keys are defined --')
Print('keys to check: %s' % keys)
if kvf.check(keys) == 0:
    Print('All keys are defined')
else:
    Print('Not all keys are defined !!')
print()
#
keys.append('GhostKey')
Print('-- GhostKey is not defined --')
Print('keys to check: %s' % keys)
if kvf.check(keys) == 0:
    Print('All keys are defined')
else:
    Print('Not all keys are defined !!')
print()

##