5
0
mirror of https://github.com/cwinfo/hyperboria-peers.git synced 2024-11-09 16:40:27 +00:00

Update tests.py to allow a single file to be tested, to help work towards #22

This commit is contained in:
Finn 2015-11-25 19:09:59 -08:00
parent 5c1ff011e4
commit b492c2a908

View File

@ -39,13 +39,17 @@ def validate(path):
print(" %sInvalid JSON!%s" % (RED, END)) print(" %sInvalid JSON!%s" % (RED, END))
return False return False
success = True if __name__ == "__main__":
for directory, subdirs, files in os.walk('.'): success = True
if len(files) > 0: if len(sys.argv) == 2:
for f in files: success = validate(sys.argv[1])
if f.endswith('.k'): else:
result = validate("%s/%s" % (directory, f)) for directory, subdirs, files in os.walk('.'):
if not result: if len(files) > 0:
success = False for f in files:
if not success: if f.endswith('.k'):
sys.exit(1) result = validate("%s/%s" % (directory, f))
if not result:
success = False
if not success:
sys.exit(1)