[Python-checkins] r65966 - in sandbox/trunk/setuptools: setup.py setuptools.egg-info/entry_points.txt setuptools.txt setuptools/command/test.py
phillip.eby
python-checkins at python.org
Thu Aug 21 23:54:17 CEST 2008
Author: phillip.eby
Date: Thu Aug 21 23:54:16 2008
New Revision: 65966
Log:
Added 'test_runner'. (Note: this is a new feature and should not
be backported to the 0.6 branch.)
Modified:
sandbox/trunk/setuptools/setup.py
sandbox/trunk/setuptools/setuptools.egg-info/entry_points.txt
sandbox/trunk/setuptools/setuptools.txt
sandbox/trunk/setuptools/setuptools/command/test.py
Modified: sandbox/trunk/setuptools/setup.py
==============================================================================
--- sandbox/trunk/setuptools/setup.py (original)
+++ sandbox/trunk/setuptools/setup.py Thu Aug 21 23:54:16 2008
@@ -53,6 +53,7 @@
"include_package_data = setuptools.dist:assert_bool",
"dependency_links = setuptools.dist:assert_string_list",
"test_loader = setuptools.dist:check_importable",
+ "test_runner = setuptools.dist:check_importable",
],
"egg_info.writers": [
"PKG-INFO = setuptools.command.egg_info:write_pkg_info",
Modified: sandbox/trunk/setuptools/setuptools.egg-info/entry_points.txt
==============================================================================
--- sandbox/trunk/setuptools/setuptools.egg-info/entry_points.txt (original)
+++ sandbox/trunk/setuptools/setuptools.egg-info/entry_points.txt Thu Aug 21 23:54:16 2008
@@ -40,6 +40,7 @@
dependency_links = setuptools.dist:assert_string_list
entry_points = setuptools.dist:check_entry_points
extras_require = setuptools.dist:check_extras
+test_runner = setuptools.dist:check_importable
package_data = setuptools.dist:check_package_data
install_requires = setuptools.dist:check_requirements
include_package_data = setuptools.dist:assert_bool
Modified: sandbox/trunk/setuptools/setuptools.txt
==============================================================================
--- sandbox/trunk/setuptools/setuptools.txt (original)
+++ sandbox/trunk/setuptools/setuptools.txt Thu Aug 21 23:54:16 2008
@@ -388,6 +388,16 @@
as long as you use the ``tests_require`` option to ensure that the package
containing the loader class is available when the ``test`` command is run.
+.. _test_runner:
+
+``test_runner``
+ If you want to use a different unittest "test runner", this can be
+ specified here. Format is the same as for `test_loader`_, i.e. entry point
+ format. The runner must be instatiable without arguments and must be
+ usable as a ``unittest`` test runner (i.e., it should have a
+ ``run(test_or_suite)`` method that returns a ``TestResult``).
+
+
``eager_resources``
A list of strings naming resources that should be extracted together, if
any of them is needed, or if any C extensions included in the project are
@@ -2263,7 +2273,7 @@
package's text test runner, but you can get the "quiet" mode (just dots) if
you supply the ``-q`` or ``--quiet`` option, either as a global option to
the setup script (e.g. ``setup.py -q test``) or as an option for the ``test``
-command itself (e.g. ``setup.py test -q``). There is one other option
+command itself (e.g. ``setup.py test -q``). Other options are
available:
``--test-suite=NAME, -s NAME``
@@ -2279,6 +2289,11 @@
If you did not set a ``test_suite`` in your ``setup()`` call, and do not
provide a ``--test-suite`` option, an error will occur.
+``--test-runner=NAME, -r NAME``
+ Specify the test runner to use. The default can be specified as an
+ argument to ``setup()``. See the `test_runner`_ documentation for details.
+ By default, the standard ``unittest.TextTestRunner`` will be used.
+
.. _upload:
@@ -2590,6 +2605,9 @@
----------------------------
0.7a1
+ * Added the `test_runner`_ setup() keyword and the ``--test-runner`` option to
+ the ``test`` command.
+
* Namespace packages' ``__init__.py`` files MUST use ``declare_namespace()``
in order to ensure that they will be handled properly at runtime. (In 0.6,
it was possible to get away without doing this, but only at the cost of
Modified: sandbox/trunk/setuptools/setuptools/command/test.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/test.py (original)
+++ sandbox/trunk/setuptools/setuptools/command/test.py Thu Aug 21 23:54:16 2008
@@ -40,7 +40,6 @@
class test(Command):
-
"""Command to run unit tests after in-place build"""
description = "run unit tests after in-place build"
@@ -49,16 +48,16 @@
('test-module=','m', "Run 'test_suite' in specified module"),
('test-suite=','s',
"Test suite to run (e.g. 'some_module.test_suite')"),
+ ('test-runner=','r', "Test runner to use"),
]
def initialize_options(self):
+ self.test_runner = None
self.test_suite = None
self.test_module = None
self.test_loader = None
-
def finalize_options(self):
-
if self.test_suite is None:
if self.test_module is None:
self.test_suite = self.distribution.test_suite
@@ -77,7 +76,8 @@
self.test_loader = getattr(self.distribution,'test_loader',None)
if self.test_loader is None:
self.test_loader = "setuptools.command.test:ScanningLoader"
-
+ if self.test_runner is None:
+ self.test_runner = getattr(self.distribution,'test_runner',None)
def with_project_on_sys_path(self, func):
@@ -125,9 +125,14 @@
import unittest
loader_ep = EntryPoint.parse("x="+self.test_loader)
loader_class = loader_ep.load(require=False)
+ runner = None
+ if self.test_runner is not None:
+ runner_ep = EntryPoint.parse("x="+self.test_runner)
+ runner_class = runner_ep.load(require=False)
+ runner = runner_class()
unittest.main(
None, None, [unittest.__file__]+self.test_args,
- testLoader = loader_class()
+ testRunner = runner, testLoader = loader_class()
)
@@ -157,8 +162,3 @@
-
-
-
-
-
More information about the Python-checkins
mailing list