From 9d091c98f1f1bf7bacf49e9eaaa18ba8bb1bfd70 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Sun, 21 Dec 2008 19:34:32 -0700 Subject: Plugin.__init__() now checks that subclass hasn't defined attributes that conflict with the logger methods; added corresponding unit test --- tests/test_ipalib/test_plugable.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tests/test_ipalib/test_plugable.py') diff --git a/tests/test_ipalib/test_plugable.py b/tests/test_ipalib/test_plugable.py index b381675b6..b05943235 100644 --- a/tests/test_ipalib/test_plugable.py +++ b/tests/test_ipalib/test_plugable.py @@ -337,6 +337,14 @@ class test_Plugin(ClassChecker): assert o.doc is None assert o.summary == '<%s>' % o.fullname + # Test that Plugin makes sure the subclass hasn't defined attributes + # whose names conflict with the logger methods set in Plugin.__init__(): + class check(self.cls): + info = 'whatever' + e = raises(StandardError, check) + assert str(e) == \ + "check.info attribute ('whatever') conflicts with Plugin logger" + def test_implements(self): """ Test the `ipalib.plugable.Plugin.implements` classmethod. -- cgit