Changeset 6727 for main


Ignore:
Timestamp:
13 Sep 2011, 08:02:51 (13 years ago)
Author:
uli
Message:

Add another logger-aware replacement for stock zope.app.testing stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/testing.py

    r6658 r6727  
    2424    """Get the keys of all logger defined globally.
    2525    """
    26     return logging.root.manager.loggerDict.keys()
     26    result = logging.root.manager.loggerDict.keys()
     27    print "\nLOGGERS: ", [x for x in result if 'waeup.sirp' in x]
     28    return result
    2729
    2830def remove_new_loggers(old_loggers):
     
    248250    ])
    249251
     252old_loggers = []
    250253def setUp(test):
     254    old_loggers = get_all_loggers()
    251255    FunctionalTestSetup().setUp()
    252256
    253257def tearDown(test):
    254258    FunctionalTestSetup().tearDown()
     259    remove_new_loggers(old_loggers)
    255260
    256261def doctestsuite_for_module(dotted_path):
     
    311316            doctest.Example('', want), got, optionflags)
    312317        self.fail(diff)
     318
     319class FunctionalTestSetup(FunctionalTestSetup):
     320    """A replacement for the zope.app.testing class.
     321
     322    Removes also loggers.
     323    """
     324
     325    def setUp(self):
     326        self.old_loggers = get_all_loggers()
     327        super(FunctionalTestSetup, self).setUp()
     328        return
     329
     330    def tearDown(self):
     331        super(FunctionalTestSetup, self).tearDown()
     332        remove_new_loggers(self.old_loggers)
     333        return
Note: See TracChangeset for help on using the changeset viewer.