|
|
@@ -10,19 +10,22 @@ def test_file(filepath):
|
|
|
def test_dir(path):
|
|
|
has_error = False
|
|
|
for filename in os.listdir(path):
|
|
|
- if filename.endswith('.py'):
|
|
|
- if(not filename.startswith('_')):
|
|
|
- continue
|
|
|
- filepath = os.path.join(path, filename)
|
|
|
- code = test_file(filepath)
|
|
|
- if not code:
|
|
|
- print("[x] " + filepath)
|
|
|
- has_error = True
|
|
|
- else:
|
|
|
- print("[v] " + filepath)
|
|
|
+ if not filename.endswith('.py'):
|
|
|
+ continue
|
|
|
+ filepath = os.path.join(path, filename)
|
|
|
+ print("> " + filepath)
|
|
|
+ code = test_file(filepath)
|
|
|
+ if not code:
|
|
|
+ has_error = True
|
|
|
+ exit(1)
|
|
|
return not has_error
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- ok = test_dir('tests')
|
|
|
+ if len(sys.argv) > 1:
|
|
|
+ d = sys.argv[1]
|
|
|
+ else:
|
|
|
+ d = 'tests/'
|
|
|
+ print("Testing directory:", d)
|
|
|
+ ok = test_dir(d)
|
|
|
if ok:
|
|
|
print("ALL TESTS PASSED")
|