summary refs log tree commit diff stats
path: root/all_tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'all_tests.py')
-rwxr-xr-xall_tests.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/all_tests.py b/all_tests.py
index b408b5de..dde73d53 100755
--- a/all_tests.py
+++ b/all_tests.py
@@ -1,11 +1,13 @@
 #!/usr/bin/python3
-import unittest
-from test import *
+"""Run all the tests inside the test/ directory as a test suite."""
+if __name__ == '__main__':
+	import unittest
+	from test import *
 
-tests = []
-for key, val in vars().copy().items():
-	if key.startswith('tc_'):
-		tests.extend(v for k,v in vars(val).items() if type(v) == type)
+	tests = []
+	for key, val in vars().copy().items():
+		if key.startswith('tc_'):
+			tests.extend(v for k,v in vars(val).items() if type(v) == type)
 
-suite = unittest.TestSuite(map(unittest.makeSuite, tests))
-unittest.TextTestRunner(verbosity=2).run(suite)
+	suite = unittest.TestSuite(map(unittest.makeSuite, tests))
+	unittest.TextTestRunner(verbosity=2).run(suite)