Log message for revision 40881: Suppress deprecation output for test of a known-to-be-deprecated feature.
Changed: U Zope/branches/2.9/lib/python/ZServer/datatypes.py U Zope/branches/2.9/lib/python/ZServer/tests/test_config.py -=- Modified: Zope/branches/2.9/lib/python/ZServer/datatypes.py =================================================================== --- Zope/branches/2.9/lib/python/ZServer/datatypes.py 2005-12-19 01:57:10 UTC (rev 40880) +++ Zope/branches/2.9/lib/python/ZServer/datatypes.py 2005-12-19 01:57:43 UTC (rev 40881) @@ -135,7 +135,8 @@ import warnings warnings.warn("Using FastCGI is deprecated. You should use mod_proxy " - "to run Zope with Apache", DeprecationWarning) + "to run Zope with Apache", DeprecationWarning, + stacklevel=2) import socket if section.address.family == socket.AF_INET: Modified: Zope/branches/2.9/lib/python/ZServer/tests/test_config.py =================================================================== --- Zope/branches/2.9/lib/python/ZServer/tests/test_config.py 2005-12-19 01:57:10 UTC (rev 40880) +++ Zope/branches/2.9/lib/python/ZServer/tests/test_config.py 2005-12-19 01:57:43 UTC (rev 40881) @@ -68,8 +68,39 @@ self.assertEqual(factory.port, 9300 + port) -class ZServerConfigurationTestCase(BaseTest): +class WarningInterceptor: + _old_stderr = None + _our_stderr_stream = None + + def _trap_warning_output( self ): + + if self._old_stderr is not None: + return + + import sys + from StringIO import StringIO + + self._old_stderr = sys.stderr + self._our_stderr_stream = sys.stderr = StringIO() + + def _free_warning_output( self ): + + if self._old_stderr is None: + return + + import sys + sys.stderr = self._old_stderr + +class ZServerConfigurationTestCase(BaseTest, WarningInterceptor): + + def setUp(self): + BaseTest.setUp(self) + + def tearDown(self): + self._free_warning_output() + BaseTest.tearDown(self) + def load_unix_domain_factory(self, text): fn = TEMPFILENAME f = open(fn, 'w') @@ -147,6 +178,7 @@ ZServer.datatypes.PCGIServerFactory)) def test_fcgi_factory(self): + self._trap_warning_output() factory = self.load_factory("""\ <fast-cgi> address 83 _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins