From 692d015627ecf03fbc23cfdb4afcf398b9a09a51 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Thu, 12 Jan 2012 17:26:28 +0100 Subject: scripts for testing and syntax unit test --- tests/test_syntax.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/test_syntax.py (limited to 'tests/test_syntax.py') 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 -- cgit v1.2.3 From c7ad1cc5b4a5d190a060e3ddd9274c3065da6708 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Fri, 13 Jan 2012 23:24:21 +0100 Subject: plugin unit test, closed #499, #500 --- tests/test_syntax.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tests/test_syntax.py') diff --git a/tests/test_syntax.py b/tests/test_syntax.py index 82c4194da..4a131ef6f 100644 --- a/tests/test_syntax.py +++ b/tests/test_syntax.py @@ -8,9 +8,8 @@ from unittest import TestCase PATH = abspath(join(dirname(abspath(__file__)), "..", "")) -# gettext -__builtin__._ = lambda x: x -__builtin__.hookManager = _ +# needed to register globals +from helper import Stubs class TestSyntax(TestCase): pass -- cgit v1.2.3 From 828cc89cc9b7a2ecacf98fc73928d988e15f0b98 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sat, 14 Jan 2012 15:49:08 +0100 Subject: captcha and attachments for plugin tester --- tests/test_syntax.py | 1 - 1 file changed, 1 deletion(-) (limited to 'tests/test_syntax.py') diff --git a/tests/test_syntax.py b/tests/test_syntax.py index 4a131ef6f..a4cc53ee5 100644 --- a/tests/test_syntax.py +++ b/tests/test_syntax.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -import __builtin__ from os import walk from os.path import abspath, dirname, join -- cgit v1.2.3