[Python-checkins] r43430 - in sandbox/trunk/setuptools: setup.py setuptools.egg-info/entry_points.txt setuptools.txt setuptools/command/test.py setuptools/dist.py
phillip.eby
python-checkins at python.org
Thu Mar 30 01:32:42 CEST 2006
Author: phillip.eby
Date: Thu Mar 30 01:32:41 2006
New Revision: 43430
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
sandbox/trunk/setuptools/setuptools/dist.py
Log:
Added ``test_loader`` keyword to support custom test loaders.
Modified: sandbox/trunk/setuptools/setup.py
==============================================================================
--- sandbox/trunk/setuptools/setup.py (original)
+++ sandbox/trunk/setuptools/setup.py Thu Mar 30 01:32:41 2006
@@ -41,27 +41,34 @@
packages = find_packages(),
package_data = {'setuptools':['*.exe']},
+
py_modules = ['pkg_resources', 'easy_install', 'site'],
+
zip_safe = False, # We want 'python -m easy_install' to work, for now :(
+
entry_points = {
+
"distutils.commands" : [
"%(cmd)s = setuptools.command.%(cmd)s:%(cmd)s" % locals()
for cmd in SETUP_COMMANDS
],
+
"distutils.setup_keywords": [
- "eager_resources = setuptools.dist:assert_string_list",
- "namespace_packages = setuptools.dist:check_nsp",
- "extras_require = setuptools.dist:check_extras",
- "install_requires = setuptools.dist:check_requirements",
- "tests_require = setuptools.dist:check_requirements",
- "entry_points = setuptools.dist:check_entry_points",
- "test_suite = setuptools.dist:check_test_suite",
- "zip_safe = setuptools.dist:assert_bool",
+ "eager_resources = setuptools.dist:assert_string_list",
+ "namespace_packages = setuptools.dist:check_nsp",
+ "extras_require = setuptools.dist:check_extras",
+ "install_requires = setuptools.dist:check_requirements",
+ "tests_require = setuptools.dist:check_requirements",
+ "entry_points = setuptools.dist:check_entry_points",
+ "test_suite = setuptools.dist:check_test_suite",
+ "zip_safe = setuptools.dist:assert_bool",
"package_data = setuptools.dist:check_package_data",
"exclude_package_data = setuptools.dist:check_package_data",
"include_package_data = setuptools.dist:assert_bool",
- "dependency_links = setuptools.dist:assert_string_list",
+ "dependency_links = setuptools.dist:assert_string_list",
+ "test_loader = setuptools.dist:check_importable",
],
+
"egg_info.writers": [
"PKG-INFO = setuptools.command.egg_info:write_pkg_info",
"requires.txt = setuptools.command.egg_info:write_requirements",
@@ -72,14 +79,17 @@
"depends.txt = setuptools.command.egg_info:warn_depends_obsolete",
"dependency_links.txt = setuptools.command.egg_info:overwrite_arg",
],
- "console_scripts":
- ["easy_install = setuptools.command.easy_install:main",
+
+ "console_scripts": [
+ "easy_install = setuptools.command.easy_install:main",
"easy_install-%s = setuptools.command.easy_install:main"
- % sys.version[:3]
+ % sys.version[:3]
],
+
"setuptools.file_finders":
["svn_cvs = setuptools.command.sdist:_default_revctrl"]
},
+
classifiers = [f.strip() for f in """
Development Status :: 3 - Alpha
Intended Audience :: Developers
@@ -111,13 +121,3 @@
-
-
-
-
-
-
-
-
-
-
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 Mar 30 01:32:41 2006
@@ -10,6 +10,7 @@
test_suite = setuptools.dist:check_test_suite
eager_resources = setuptools.dist:assert_string_list
zip_safe = setuptools.dist:assert_bool
+test_loader = setuptools.dist:check_importable
tests_require = setuptools.dist:check_requirements
[setuptools.file_finders]
Modified: sandbox/trunk/setuptools/setuptools.txt
==============================================================================
--- sandbox/trunk/setuptools/setuptools.txt (original)
+++ sandbox/trunk/setuptools/setuptools.txt Thu Mar 30 01:32:41 2006
@@ -362,6 +362,27 @@
are run, but only downloaded to the project's setup directory if they're
not already installed locally.
+``test_loader``
+ If you would like to use a different way of finding tests to run than what
+ setuptools normally uses, you can specify a module name and class name in
+ this argument. The named class must be instantiable with no arguments, and
+ its instances must support the ``loadTestsFromNames()`` method as defined
+ in the Python ``unittest`` module's ``TestLoader`` class. Setuptools will
+ pass only one test "name" in the `names` argument: the value supplied for
+ the ``test_suite`` argument. The loader you specify may interpret this
+ string in any way it likes, as there are no restrictions on what may be
+ contained in a ``test_suite`` string.
+
+ The module name and class name must be separated by a ``:``; the default
+ value of this argument is ``"setuptools.command.test:ScanningLoader"``. If
+ you want to use the default ``unittest`` behavior instead, you can specify
+ ``"unittest:TestLoader"`` as your ``test_loader`` argument instead. This
+ will prevent automatic scanning of submodules and subpackages.
+
+ The module and class you specify here may be contained in another package,
+ 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.
+
``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
@@ -2471,6 +2492,8 @@
----------------------------
0.6a11
+ * Added ``test_loader`` keyword to support custom test loaders
+
* Added ``setuptools.file_finders`` entry point group to allow implementing
revision control plugins.
Modified: sandbox/trunk/setuptools/setuptools/command/test.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/test.py (original)
+++ sandbox/trunk/setuptools/setuptools/command/test.py Thu Mar 30 01:32:41 2006
@@ -51,11 +51,10 @@
"Test suite to run (e.g. 'some_module.test_suite')"),
]
- test_suite = None
- test_module = None
-
def initialize_options(self):
- pass
+ self.test_suite = None
+ self.test_module = None
+ self.test_loader = None
def finalize_options(self):
@@ -74,9 +73,10 @@
if self.verbose:
self.test_args.insert(0,'--verbose')
-
-
-
+ if self.test_loader is None:
+ self.test_loader = getattr(self.distribution,'test_loader',None)
+ if self.test_loader is None:
+ self.test_loader = "setuptools.command.test:ScanningLoader"
@@ -111,13 +111,13 @@
dist = Distribution(path_item, metadata, project_name=ei_cmd.egg_name)
working_set.add(dist)
require(str(dist.as_requirement()))
+ loader_ep = EntryPoint.parse("x="+self.test_loader)
+ loader_class = loader_ep.load(require=False)
unittest.main(
None, None, [unittest.__file__]+self.test_args,
- testLoader = ScanningLoader()
+ testLoader = loader_class()
)
-
-
Modified: sandbox/trunk/setuptools/setuptools/dist.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/dist.py (original)
+++ sandbox/trunk/setuptools/setuptools/dist.py Thu Mar 30 01:32:41 2006
@@ -28,15 +28,15 @@
sequence = tuple, list
-
-
-
-
-
-
-
-
-
+def check_importable(dist, attr, value):
+ try:
+ ep = pkg_resources.EntryPoint.parse('x='+value)
+ assert not ep.extras
+ except (TypeError,ValueError,AttributeError,AssertionError):
+ raise DistutilsSetupError(
+ "%r must be importable 'module:attrs' string (got %r)"
+ % (attr,value)
+ )
def assert_string_list(dist, attr, value):
More information about the Python-checkins
mailing list