[Zope3-checkins] SVN: zope.testing/branches/tseaver-eggsupport/ - Added an alterate setuptools / distutils commands for running all tests
Tres Seaver
tseaver at palladion.com
Fri Sep 19 10:32:44 EDT 2008
Log message for revision 91272:
- Added an alterate setuptools / distutils commands for running all tests
using our testrunner. See 'zope.testing.testrunner.eggsupport:ftest'.
- Added a setuptools-compatible test loader which skips tests with layers:
the testrunner used by 'setup.py test' doesn't know about them, and those
tests then fail. See 'zope.testing.testrunner.eggsupport:SkipLayers'.
- Split out changelog from README.txt.
Changed:
A zope.testing/branches/tseaver-eggsupport/CHANGES.txt
A zope.testing/branches/tseaver-eggsupport/src/zope/testing/testrunner/eggsupport.py
-=-
Added: zope.testing/branches/tseaver-eggsupport/CHANGES.txt
===================================================================
--- zope.testing/branches/tseaver-eggsupport/CHANGES.txt (rev 0)
+++ zope.testing/branches/tseaver-eggsupport/CHANGES.txt 2008-09-19 14:32:44 UTC (rev 91272)
@@ -0,0 +1,135 @@
+zope.testing Changelog
+**********************
+
+after 3.6.0 (unreleased)
+========================
+
+- Added an alterate setuptools / distutils commands for running all tests
+ using our testrunner. See 'zope.testing.testrunner.eggsupport:ftest'.
+
+- Added a setuptools-compatible test loader which skips tests with layers:
+ the testrunner used by 'setup.py test' doesn't know about them, and those
+ tests then fail. See 'zope.testing.testrunner.eggsupport:SkipLayers'.
+
+- Added support for Jython, when a garbage collector call is sent.
+
+- Added support to bootstrap on Jython.
+
+- Fixed NameError in StartUpFailure.
+
+- Open doctest files in universal mode, so that packages released in Windoes
+ can be tested in Linux, for example.
+
+
+3.6.0 (2008/07/10)
+==================
+
+- Added -j option to parallel tests run in subprocesses.
+
+- RENormalizer accepts plain Python callables.
+
+- Added --slow-test option.
+
+- Added --no-progress and --auto-progress options.
+
+- Complete refactoring of the test runner into multiple code files and a more
+ modular (pipeline-like) architecture.
+
+- Unified unit tests with the layer support by introducing a real unit test
+ layer.
+
+- Added a doctest for ``zope.testing.module``. There were several bugs
+ that were fixed:
+
+ * ``README.txt`` was a really bad default argument for the module
+ name, as it is not a proper dotted name. The code would
+ immediately fail as it would look for the ``txt`` module in the
+ ``README`` package. The default is now ``__main__``.
+
+ * The tearDown function did not clean up the ``__name__`` entry in the
+ global dictionary.
+
+- Fix a bug that caused a SubprocessError to be generated if a subprocess
+ sent any output to stderr.
+
+- Fix a bug that caused the unit tests to be skipped if run in a subprocess.
+
+
+3.5.1 (2007/08/14)
+==================
+
+Bugs Fixed:
+-----------
+
+- Post-mortem debugging wasn't invoked for layer-setup failures.
+
+3.5.0 (2007/07/19)
+==================
+
+New Features
+------------
+
+- The test runner now works on Python 2.5.
+
+- Added support for cProfile.
+
+- Added output colorizing (-c option).
+
+- Added --hide-secondary-failures and --show-secondary-failures options
+ (https://bugs.launchpad.net/zope3/+bug/115454).
+
+Bugs Fixed:
+-----------
+
+- Fix some problems with Unicode in doctests.
+
+- Fix "Error reading from subprocess" errors on Unix-like systems.
+
+3.4 (2007/03/29)
+================
+
+New Features
+------------
+
+- Added exit-with-status support (supports use with buildbot and
+ zc.recipe.testing)
+
+- Added a small framework for automating set up and tear down of
+ doctest tests. See setupstack.txt.
+
+Bugs Fixed:
+-----------
+
+- Fix testrunner-wo-source.txt and testrunner-errors.txt to run with a
+ read-only source tree.
+
+3.0 (2006/09/20)
+================
+
+- Updated the doctest copy with text-file encoding support.
+
+- Added logging-level support to loggingsuppport module.
+
+- At verbosity-level 1, dots are not output continuously, without any
+ line breaks.
+
+- Improved output when the inability to tear down a layer causes tests
+ to be run in a subprocess.
+
+- Made zope.exception required only if the zope_tracebacks extra is
+ requested.
+
+2.x.y (???)
+===========
+
+- Fix the test coverage. If a module, for example `interfaces`, was in an
+ ignored directory/package, then if a module of the same name existed in a
+ covered directory/package, then it was also ignored there, because the
+ ignore cache stored the result by module name and not the filename of the
+ module.
+
+2.0 (2006/01/05)
+================
+
+- Corresponds to the version of the zope.testing package shipped as part of
+ the Zope 3.2.0 release.
Added: zope.testing/branches/tseaver-eggsupport/src/zope/testing/testrunner/eggsupport.py
===================================================================
--- zope.testing/branches/tseaver-eggsupport/src/zope/testing/testrunner/eggsupport.py (rev 0)
+++ zope.testing/branches/tseaver-eggsupport/src/zope/testing/testrunner/eggsupport.py 2008-09-19 14:32:44 UTC (rev 91272)
@@ -0,0 +1,114 @@
+""" Add unit and functional testing support to setuptools-driven eggs.
+"""
+from setuptools.command.test import ScanningLoader
+from setuptools.command.test import test as BaseCommand
+
+
+def skipLayers(suite):
+ """ Walk the suite returned by setuptools' testloader.
+
+ o Skip any tests which have a 'layer' defined.
+ """
+ from unittest import TestSuite
+ result = TestSuite()
+ for test in suite._tests:
+ if isinstance(test, TestSuite):
+ result.addTest(skipLayers(test))
+ else:
+ layer = getattr(test, 'layer', None)
+ if layer is None:
+ result.addTest(test)
+ return result
+
+class SkipLayers(ScanningLoader):
+ """ Load only unit tests (those which have no layer associated with them).
+
+ o Running the tests using 'setup.py test' cannot, by default, drive the
+ full testrunner, with its support for layers (in functional tests).
+ This loader allows the command to work, by running only those tests
+ which don't need the layer support.
+
+ o To run layer-dependent tests, use 'setup.py ftest' (see below for
+ adding the command to your setup.py).
+
+ o To use this loader your pacakge add the following your 'setup()'
+ call::
+
+ setup(
+ ...
+ setup_requires=['eggtestinfo' # captures testing metadata in EGG-INFO
+ ],
+ tests_require=['zope.testing >= 3.6.1dev', #XXX fix version at release
+ ],
+ ...
+ test_loader='zope.testing.testrunner.eggsupport:SkipLayers',
+ ...
+ )
+ """
+ def loadTestsFromModule(self, module):
+ return skipLayers(ScanningLoader.loadTestsFromModule(self, module))
+
+def print_usage():
+ print 'python setup.py ftest'
+ print
+ print ftest.__doc__
+
+class ftest(BaseCommand):
+ """ Run unit and functional tests after an in-place build.
+
+ o Note that this command runs *all* tests (unit *and* functional).
+
+ o This command does not provide any of the configuration options which
+ the usual testrunner provided by 'zope.testing' offers: it is intended
+ to allow easy verification that a package has been installed correctly
+ via setuptools, but is not likely to be useful for developers working
+ on the package.
+
+ o Developers working on the package will likely prefer to work with
+ the stock testrunner, e.g., by using buildout with a recipe which
+ configures the testrunner as a standalone script.
+
+ o To use this in your pacakge add the following to the 'entry_points'
+ section::
+
+ setup(
+ ...
+ setup_requires=['zope.testing >= 3.6.1dev', #XXX fix version at release
+ 'eggtestinfo' # captures testing metadata in EGG-INFO
+ ],
+ ...
+ entry_points='''
+ [setuptools.commands]
+ ftest = zope.testing.testrunner.eggsupport:SetuptoolsFunctionalTest
+ '''
+ ...
+ )
+ """
+ description = "Run all functional and unit tests after in-place build"
+ user_options = []
+ help_options = [('usage', '?', 'Show usage', print_usage)]
+
+ def initialize_options(self):
+ pass # suppress normal handling
+
+ def finalize_options(self):
+ pass # suppress normal handling
+
+ def run(self):
+ from zope.testing.testrunner import run
+
+ dist = self.distribution
+ where = dist.package_dir or '.'
+ args = ['IGNORE_ME', '--test-path', where]
+
+ if dist.install_requires:
+ dist.fetch_build_eggs(dist.install_requires)
+
+ if dist.tests_require:
+ dist.fetch_build_eggs(dist.tests_require)
+
+ def _run():
+ run(args=args)
+
+ self.with_project_on_sys_path(_run)
+
More information about the Zope3-Checkins
mailing list