summaryrefslogtreecommitdiff
path: root/v1/tests/TestModules.py
diff options
context:
space:
mode:
Diffstat (limited to 'v1/tests/TestModules.py')
-rw-r--r--v1/tests/TestModules.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/v1/tests/TestModules.py b/v1/tests/TestModules.py
new file mode 100644
index 0000000000..aef2e83ed6
--- /dev/null
+++ b/v1/tests/TestModules.py
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+
+import os
+import ast
+import unittest
+from ansible import utils
+
+
+class TestModules(unittest.TestCase):
+
+ def list_all_modules(self):
+ paths = utils.plugins.module_finder._get_paths()
+ paths = [x for x in paths if os.path.isdir(x)]
+ module_list = []
+ for path in paths:
+ for (dirpath, dirnames, filenames) in os.walk(path):
+ for filename in filenames:
+ (path, ext) = os.path.splitext(filename)
+ if ext == ".py":
+ module_list.append(os.path.join(dirpath, filename))
+ return module_list
+
+ def test_ast_parse(self):
+ module_list = self.list_all_modules()
+ ERRORS = []
+ # attempt to parse each module with ast
+ for m in module_list:
+ try:
+ ast.parse(''.join(open(m)))
+ except Exception, e:
+ ERRORS.append((m, e))
+ assert len(ERRORS) == 0, "get_docstring errors: %s" % ERRORS