Author: jure
Date: Tue Feb 19 08:51:39 2013
New Revision: 1447629

URL: http://svn.apache.org/r1447629
Log:
#355, clean-ups to make rational use of environment stub's logger and handler, 
patch t355_r1446579_cleanup_logging.diff applied (from Olemis)


Modified:
    
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/env.py

Modified: 
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/env.py
URL: 
http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/env.py?rev=1447629&r1=1447628&r2=1447629&view=diff
==============================================================================
--- 
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/env.py
 (original)
+++ 
incubator/bloodhound/branches/bep_0003_multiproduct/bloodhound_multiproduct/tests/env.py
 Tue Feb 19 08:51:39 2013
@@ -159,6 +159,21 @@ class MultiproductTestCase(unittest.Test
         env.log.info('%s test case: %s %s',
                 '-' * 10, self.id(), '-' * 10)
 
+        # Clean-up logger instance and associated handler
+        # Otherwise large test suites will only result in ERROR eventually
+        # (at least in Unix systems) with messages 
+        #
+        # TracError: Error reading '/path/to/file', make sure it is readable.
+        # error: /path/to/: Too many open files
+        self.addCleanup(self._teardown_test_log, env)
+
+    def _teardown_test_log(self, env):
+        if env.log and hasattr(env, '_log_handler'):
+            env.log.removeHandler(env._log_handler)
+            env._log_handler.flush()
+            env._log_handler.close()
+            del env._log_handler
+
     def _load_product_from_data(self, env, prefix):
         r"""Ensure test product with prefix is loaded
         """


Reply via email to