From 80aa40537a3596f24593b5a67adb6d635fe4fa22 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 7 Jul 2011 12:55:03 +0200 Subject: Added auto-skip mixin metacls, some serious brainfuck, if the required module was not found. Its actually a nice mix between decorators which are class types, and a mixin as a metaclass, which applies said decorator. The InstanceDecorator wouldn't actually be needed, but it adds flexibility. Maybe it should be removed ... --- git/test/db/dulwich/lib.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 git/test/db/dulwich/lib.py (limited to 'git/test/db/dulwich/lib.py') diff --git a/git/test/db/dulwich/lib.py b/git/test/db/dulwich/lib.py new file mode 100644 index 00000000..a1110ffa --- /dev/null +++ b/git/test/db/dulwich/lib.py @@ -0,0 +1,18 @@ +"""dulwich specific utilities, as well as all the default ones""" + +from git.test.lib import * + +#{ Decoorators + +def needs_dulwich_or_skip(func): + """Skip this test if we have no dulwich - print warning""" + return needs_module_or_skip('dulwich')(func) + +#}END decorators + +#{ MetaClasses + +class DulwichRequiredMetaMixin(InheritedTestMethodsOverrideWrapperMetaClsAutoMixin): + decorator = [needs_dulwich_or_skip] + +#} END metaclasses -- cgit v1.2.3 From 4bb5107cff6f205f5c6e73a6f8bd22fc56f48cf4 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Thu, 7 Jul 2011 14:53:37 +0200 Subject: Initial version of the DulwichType inheritance. For now, it inherits everything from the existing implementation, but one by one things can be reimplmented to use dulwich. It also shows that py 2.6 is quite plagued from its new feature, which is actually a bug, as objects inability to accept any args makes mixins hard to use ... --- git/test/db/dulwich/lib.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'git/test/db/dulwich/lib.py') diff --git a/git/test/db/dulwich/lib.py b/git/test/db/dulwich/lib.py index a1110ffa..56734064 100644 --- a/git/test/db/dulwich/lib.py +++ b/git/test/db/dulwich/lib.py @@ -1,6 +1,11 @@ """dulwich specific utilities, as well as all the default ones""" -from git.test.lib import * +from git.test.lib import ( + InheritedTestMethodsOverrideWrapperMetaClsAutoMixin, + needs_module_or_skip + ) + +__all__ = ['needs_dulwich_or_skip', 'DulwichRequiredMetaMixin'] #{ Decoorators -- cgit v1.2.3