summaryrefslogtreecommitdiffstats
path: root/tests/test_syntax.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-12 17:26:28 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2012-01-12 17:26:28 +0100
commit692d015627ecf03fbc23cfdb4afcf398b9a09a51 (patch)
tree3a3b65808c37aecd4d270b3d40850ae52f33a355 /tests/test_syntax.py
parentchanged HEAD request (diff)
downloadpyload-692d015627ecf03fbc23cfdb4afcf398b9a09a51.tar.xz
scripts for testing and syntax unit test
Diffstat (limited to 'tests/test_syntax.py')
-rw-r--r--tests/test_syntax.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/test_syntax.py b/tests/test_syntax.py
new file mode 100644
index 000000000..82c4194da
--- /dev/null
+++ b/tests/test_syntax.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+
+import __builtin__
+from os import walk
+from os.path import abspath, dirname, join
+
+from unittest import TestCase
+
+PATH = abspath(join(dirname(abspath(__file__)), "..", ""))
+
+# gettext
+__builtin__._ = lambda x: x
+__builtin__.hookManager = _
+
+class TestSyntax(TestCase):
+ pass
+
+
+for path, dirs, files in walk(join(PATH, "module")):
+
+ for f in files:
+ if not f.endswith(".py") or f.startswith("__"): continue
+ fpath = join(path, f)
+ pack = fpath.replace(PATH, "")[1:-3] #replace / and .py
+ imp = pack.replace("/", ".")
+ packages = imp.split(".")
+ #__import__(imp)
+
+ # to much sideeffect when importing
+ if "web" in packages or "lib" in packages: continue
+ if "ThriftTest" in packages: continue
+
+ # currying
+ def meta(imp, sig):
+ def _test(self=None):
+ __import__(imp)
+
+ _test.func_name = sig
+ return _test
+
+ # generate test methods
+ sig = "test_%s_%s" % (packages[-2], packages[-1])
+
+
+ setattr(TestSyntax, sig, meta(imp, sig)) \ No newline at end of file