Return-Path: X-Original-To: apmail-incubator-bloodhound-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-bloodhound-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8D649E074 for ; Fri, 22 Feb 2013 14:04:21 +0000 (UTC) Received: (qmail 17234 invoked by uid 500); 22 Feb 2013 14:04:21 -0000 Delivered-To: apmail-incubator-bloodhound-commits-archive@incubator.apache.org Received: (qmail 17220 invoked by uid 500); 22 Feb 2013 14:04:21 -0000 Mailing-List: contact bloodhound-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: bloodhound-dev@incubator.apache.org Delivered-To: mailing list bloodhound-commits@incubator.apache.org Received: (qmail 17213 invoked by uid 99); 22 Feb 2013 14:04:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Feb 2013 14:04:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Feb 2013 14:04:18 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E6C8C2388900; Fri, 22 Feb 2013 14:03:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1449047 - in /incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct: multiproduct/env.py tests/wiki/macros.py Date: Fri, 22 Feb 2013 14:03:57 -0000 To: bloodhound-commits@incubator.apache.org From: jure@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130222140357.E6C8C2388900@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jure Date: Fri Feb 22 14:03:57 2013 New Revision: 1449047 URL: http://svn.apache.org/r1449047 Log: #355, wiki macros test cases, patch t355_r1446579_trac_test_wiki_macros.diff applied (from Olemis) Added: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/macros.py Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py Modified: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py?rev=1449047&r1=1449046&r2=1449047&view=diff ============================================================================== --- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py (original) +++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/multiproduct/env.py Fri Feb 22 14:03:57 2013 @@ -193,6 +193,14 @@ class ProductEnvironment(Component, Comp implements(trac.env.ISystemInfoProvider) + def __getitem__(self, cls): + if issubclass(cls, trac.env.Environment): + return self.parent + elif cls is self.__class__: + return self + else: + return ComponentManager.__getitem__(self, cls) + def __getattr__(self, attrnm): """Forward attribute access request to parent environment. @@ -211,6 +219,11 @@ class ProductEnvironment(Component, Comp raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, attrnm)) + def __repr__(self): + return "<%s %s at %s>" % (self.__class__.__name__, + repr(self.product.prefix), + hex(id(self))) + @lazy def path(self): """The subfolder `./products/` relative to the @@ -394,7 +407,14 @@ class ProductEnvironment(Component, Comp `None`, the component only gets activated if it is located in the `plugins` directory of the environment. """ - if self.parent[cls] is None: + if cls is self.__class__: + # Prevent lookups in parent env ... will always fail + return True + # FIXME : Maybe checking for ComponentManager is too drastic + elif issubclass(cls, ComponentManager): + # Avoid clashes with overridden Environment's options + return False + elif self.parent[cls] is None: return False return self.is_component_enabled_local(cls) Added: incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/macros.py URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/macros.py?rev=1449047&view=auto ============================================================================== --- incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/macros.py (added) +++ incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/wiki/macros.py Fri Feb 22 14:03:57 2013 @@ -0,0 +1,75 @@ + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +"""Tests for inherited Apache(TM) Bloodhound's wiki macros +in product environments""" + +import os.path +import re +import unittest + +from trac.wiki.tests import macros + +from multiproduct.env import ProductEnvironment +from tests.env import MultiproductTestCase +from tests.wiki import formatter + +def test_suite(): + suite = unittest.TestSuite() + suite.addTest(formatter.test_suite( + macros.IMAGE_MACRO_TEST_CASES, + file=macros.__file__)) + suite.addTest(formatter.test_suite( + macros.TITLEINDEX1_MACRO_TEST_CASES, + file=macros.__file__)) + suite.addTest(formatter.test_suite( + macros.TITLEINDEX2_MACRO_TEST_CASES, + file=macros.__file__, + setup=macros.titleindex2_setup, + teardown=macros.titleindex_teardown)) + suite.addTest(formatter.test_suite( + macros.TITLEINDEX3_MACRO_TEST_CASES, + file=macros.__file__, + setup=macros.titleindex3_setup, + teardown=macros.titleindex_teardown)) + suite.addTest(formatter.test_suite( + macros.TITLEINDEX4_MACRO_TEST_CASES, + file=macros.__file__, + setup=macros.titleindex4_setup, + teardown=macros.titleindex_teardown)) + suite.addTest(formatter.test_suite( + macros.TITLEINDEX5_MACRO_TEST_CASES, + file=macros.__file__, + setup=macros.titleindex5_setup, + teardown=macros.titleindex_teardown)) + suite.addTest(formatter.test_suite( + macros.RECENTCHANGES_MACRO_TEST_CASES, + file=macros.__file__, + setup=macros.recentchanges_setup, + teardown=macros.recentchanges_teardown)) + suite.addTest(formatter.test_suite( + macros.TRACINI_MACRO_TEST_CASES, + file=macros.__file__, + setup=macros.tracini_setup, + teardown=macros.tracini_teardown)) + return suite + + +if __name__ == '__main__': + unittest.main(defaultTest='test_suite') +