Log message for revision 73189: Removed broken profiler support. Changed: U Zope/trunk/lib/python/Testing/ZopeTestCase/__init__.py U Zope/trunk/lib/python/Testing/ZopeTestCase/base.py U Zope/trunk/lib/python/Testing/ZopeTestCase/doc/API.stx U Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt D Zope/trunk/lib/python/Testing/ZopeTestCase/doc/PROFILER.stx U Zope/trunk/lib/python/Testing/ZopeTestCase/interfaces.py D Zope/trunk/lib/python/Testing/ZopeTestCase/profiler.py U Zope/trunk/lib/python/Testing/ZopeTestCase/testInterfaces.py U Zope/trunk/lib/python/Testing/ZopeTestCase/ztc_common.py
-=- Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/__init__.py =================================================================== --- Zope/trunk/lib/python/Testing/ZopeTestCase/__init__.py 2007-03-15 13:05:38 UTC (rev 73188) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/__init__.py 2007-03-15 13:18:45 UTC (rev 73189) @@ -33,7 +33,6 @@ from PortalTestCase import portal_name from PortalTestCase import PortalTestCase -from profiler import Profiled from sandbox import Sandboxed from functional import Functional Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/base.py =================================================================== --- Zope/trunk/lib/python/Testing/ZopeTestCase/base.py 2007-03-15 13:05:38 UTC (rev 73188) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/base.py 2007-03-15 13:18:45 UTC (rev 73189) @@ -18,7 +18,6 @@ import ZopeLite as Zope2 import unittest import transaction -import profiler import utils import interfaces import connections @@ -41,7 +40,7 @@ -class TestCase(profiler.Profiled, unittest.TestCase, object): +class TestCase(unittest.TestCase, object): '''Base test case for Zope testing ''' Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/doc/API.stx =================================================================== --- Zope/trunk/lib/python/Testing/ZopeTestCase/doc/API.stx 2007-03-15 13:05:38 UTC (rev 73188) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/doc/API.stx 2007-03-15 13:18:45 UTC (rev 73189) @@ -57,8 +57,6 @@ PortalTestCase - Profiled - Sandboxed Functional @@ -243,38 +241,6 @@ -Module profiler - - Profiling support - - Functions - - runcall(func, *args, **kw) - - print_stats() - - dump_stats(filename) - - Classes - - Profiled - - - -Class Profiled - - Profiling support mix-in for xTestCases - - Interfaces - - implements(IProfiled) - - Methods - - runcall(func, *args, **kw) - - - Module sandbox ZODB sandbox support Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt =================================================================== --- Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2007-03-15 13:05:38 UTC (rev 73188) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/doc/CHANGES.txt 2007-03-15 13:18:45 UTC (rev 73189) @@ -1,5 +1,6 @@ 0.9.10 (Zope 2.11 edition) - Switched to Zope3 interfaces. +- Removed broken profiler support. 0.9.9 (Zope 2.11 edition) - transaction.commit(1) is deprecated in favor of transaction.savepoint(1). Deleted: Zope/trunk/lib/python/Testing/ZopeTestCase/doc/PROFILER.stx =================================================================== --- Zope/trunk/lib/python/Testing/ZopeTestCase/doc/PROFILER.stx 2007-03-15 13:05:38 UTC (rev 73188) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/doc/PROFILER.stx 2007-03-15 13:18:45 UTC (rev 73189) @@ -1,19 +0,0 @@ -<style type="text/css"> <!-- li { margin: 1em } --> </style> - -Profiler Readme - - Since version 0.9.0 all xTestCases are profiler aware by default. - - You can run your tests under profiler control like this:: - - python testSomething.py profile - - If you want to profile fixture creation or destruction type one of:: - - python testSomething.py profile-setup - python testSomething.py profile-teardown - - Profiler statistics will be printed after the test results. - - See the API reference for more on the 'profiler' module. - Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/interfaces.py =================================================================== --- Zope/trunk/lib/python/Testing/ZopeTestCase/interfaces.py 2007-03-15 13:05:38 UTC (rev 73188) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/interfaces.py 2007-03-15 13:18:45 UTC (rev 73189) @@ -95,14 +95,6 @@ '''This is currently the same as IZopeSecurity''' -class IProfiled(Interface): - - def runcall(func, *args, **kw): - '''Allows to run a function under profiler control - adding to the accumulated profiler statistics. - ''' - - class IFunctional(Interface): def publish(path, basic=None, env=None, extra=None, request_method='GET', stdin=None): Deleted: Zope/trunk/lib/python/Testing/ZopeTestCase/profiler.py =================================================================== --- Zope/trunk/lib/python/Testing/ZopeTestCase/profiler.py 2007-03-15 13:05:38 UTC (rev 73188) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/profiler.py 2007-03-15 13:18:45 UTC (rev 73189) @@ -1,122 +0,0 @@ -############################################################################## -# -# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved. -# -# This software is subject to the provisions of the Zope Public License, -# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. -# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED -# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS -# FOR A PARTICULAR PURPOSE. -# -############################################################################## -"""Profiling support for ZTC - -$Id$ -""" - -import os, sys -import interfaces - -from zope.interface import implements - -# Some distros ship without profile -try: - from profile import Profile - from pstats import Stats -except ImportError: - def Profile(): pass - -_profile = Profile() -_have_stats = 0 - -limit = ('.py:', 200) -sort = ('cumulative', 'time', 'pcalls') -strip_dirs = 1 - - -def runcall(*args, **kw): - if _profile is None: - return apply(args[0], args[1:], kw) - else: - global _have_stats - _have_stats = 1 - return apply(_profile.runcall, args, kw) - - -def print_stats(limit=limit, sort=sort, strip_dirs=strip_dirs): - if _have_stats: - stats = Stats(_profile) - if strip_dirs: - stats.strip_dirs() - apply(stats.sort_stats, sort) - apply(stats.print_stats, limit) - - -def dump_stats(filename): - if _have_stats: - _profile.dump_stats(filename) - - -class Profiled: - '''Derive from this class and an xTestCase to get profiling support:: - - class MyTest(Profiled, ZopeTestCase): - ... - - Then run the test module by typing:: - - $ python testSomething.py profile - - Profiler statistics will be printed after the test results. - ''' - - implements(interfaces.IProfiled) - - def runcall(self, *args, **kw): - return apply(runcall, args, kw) - - def __call__(self, result=None): - if result is None: result = self.defaultTestResult() - result.startTest(self) - testMethod = getattr(self, self._TestCase__testMethodName) - try: - try: - if int(os.environ.get('PROFILE_SETUP', 0)): - self.runcall(self.setUp) - else: - self.setUp() - except KeyboardInterrupt: - raise - except: - result.addError(self, self._TestCase__exc_info()) - return - - ok = 0 - try: - if int(os.environ.get('PROFILE_TESTS', 0)): - self.runcall(testMethod) - else: - testMethod() - ok = 1 - except self.failureException: - result.addFailure(self, self._TestCase__exc_info()) - except KeyboardInterrupt: - raise - except: - result.addError(self, self._TestCase__exc_info()) - - try: - if int(os.environ.get('PROFILE_TEARDOWN', 0)): - self.runcall(self.tearDown) - else: - self.tearDown() - except KeyboardInterrupt: - raise - except: - result.addError(self, self._TestCase__exc_info()) - ok = 0 - if ok: result.addSuccess(self) - finally: - result.stopTest(self) - Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/testInterfaces.py =================================================================== --- Zope/trunk/lib/python/Testing/ZopeTestCase/testInterfaces.py 2007-03-15 13:05:38 UTC (rev 73188) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/testInterfaces.py 2007-03-15 13:18:45 UTC (rev 73189) @@ -28,19 +28,12 @@ class TestAbstractClasses(TestCase): - def testIProfiled(self): - self.failUnless(verifyClass(IProfiled, Profiled)) - def testIFunctional(self): self.failUnless(verifyClass(IFunctional, Functional)) class TestBaseTestCase(TestCase): - def testIProfiled(self): - self.failUnless(verifyClass(IProfiled, TestCase)) - self.failUnless(verifyObject(IProfiled, self)) - def testIZopeTestCase(self): self.failUnless(verifyClass(IZopeTestCase, TestCase)) self.failUnless(verifyObject(IZopeTestCase, self)) @@ -50,10 +43,6 @@ _setup_fixture = 0 - def testIProfiled(self): - self.failUnless(verifyClass(IProfiled, ZopeTestCase)) - self.failUnless(verifyObject(IProfiled, self)) - def testIZopeTestCase(self): self.failUnless(verifyClass(IZopeTestCase, ZopeTestCase)) self.failUnless(verifyObject(IZopeTestCase, self)) @@ -71,10 +60,6 @@ self.failUnless(verifyClass(IFunctional, FunctionalTestCase)) self.failUnless(verifyObject(IFunctional, self)) - def testIProfiled(self): - self.failUnless(verifyClass(IProfiled, FunctionalTestCase)) - self.failUnless(verifyObject(IProfiled, self)) - def testIZopeTestCase(self): self.failUnless(verifyClass(IZopeTestCase, FunctionalTestCase)) self.failUnless(verifyObject(IZopeTestCase, self)) @@ -91,10 +76,6 @@ def _portal(self): return None - def testIProfiled(self): - self.failUnless(verifyClass(IProfiled, PortalTestCase)) - self.failUnless(verifyObject(IProfiled, self)) - def testIZopeTestCase(self): self.failUnless(verifyClass(IZopeTestCase, PortalTestCase)) self.failUnless(verifyObject(IZopeTestCase, self)) Modified: Zope/trunk/lib/python/Testing/ZopeTestCase/ztc_common.py =================================================================== --- Zope/trunk/lib/python/Testing/ZopeTestCase/ztc_common.py 2007-03-15 13:05:38 UTC (rev 73188) +++ Zope/trunk/lib/python/Testing/ZopeTestCase/ztc_common.py 2007-03-15 13:18:45 UTC (rev 73189) @@ -21,7 +21,7 @@ """ # Overwrites the default framework() method to expose the -# TestRunner parameters and add profiler support. +# TestRunner parameters # def framework(stream=sys.stderr, descriptions=1, verbosity=1): if __name__ != '__main__': @@ -29,17 +29,9 @@ if len(sys.argv) > 1: arg = sys.argv[1] - if arg in ('profile', 'profile-tests'): - os.environ['PROFILE_TESTS'] = '1' - elif arg == 'profile-setup': - os.environ['PROFILE_SETUP'] = '1' - elif arg == 'profile-teardown': - os.environ['PROFILE_TEARDOWN'] = '1' - else: - sys.exit(globals()[arg]() and 1 or 0) + sys.exit(globals()[arg]() and 1 or 0) result = TestRunner(stream, descriptions, verbosity).run(test_suite()) - from Testing.ZopeTestCase import profiler; profiler.print_stats() sys.exit(len(result.errors) + len(result.failures)) _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org http://mail.zope.org/mailman/listinfo/zope-checkins