setup: bundle a copy of setuptools_trial as an unzipped egg in the base dir of the Tahoe-LAFS source tree

This is to work-around this Distribute issue:
http://bitbucket.org/tarek/distribute/issue/55/revision-control-plugin-automatically-installed-as-a-build-dependency-is-not-present-when-another-build-dependency-is-being
This commit is contained in:
Zooko O'Whielacronx 2010-06-03 21:46:48 -07:00
parent aff500c01c
commit 37444ce103
12 changed files with 264 additions and 0 deletions

View File

@ -0,0 +1,25 @@
Metadata-Version: 1.0
Name: setuptools-trial
Version: 0.5.9
Summary: Setuptools plugin that makes unit tests execute with trial instead of pyunit.
Home-page: http://allmydata.org/trac/setuptools_trial
Author: Chris Galvan
Author-email: cgalvan@enthought.com
License: BSD
Description: UNKNOWN
Keywords: distutils setuptools trial setuptools_plugin
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: BSD License
Classifier: License :: DFSG approved
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.4
Classifier: Programming Language :: Python :: 2.5
Classifier: Programming Language :: Python :: 2.6
Classifier: Topic :: Utilities
Classifier: Topic :: Software Development :: Libraries
Classifier: Framework :: Setuptools Plugin

View File

@ -0,0 +1,24 @@
COPYING.SPL.txt
README.txt
setup.py
setuptools_darcs-1.2.11-py2.6.egg/EGG-INFO/PKG-INFO
setuptools_darcs-1.2.11-py2.6.egg/EGG-INFO/SOURCES.txt
setuptools_darcs-1.2.11-py2.6.egg/EGG-INFO/dependency_links.txt
setuptools_darcs-1.2.11-py2.6.egg/EGG-INFO/entry_points.txt
setuptools_darcs-1.2.11-py2.6.egg/EGG-INFO/not-zip-safe
setuptools_darcs-1.2.11-py2.6.egg/EGG-INFO/top_level.txt
setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/__init__.py
setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/_version.py
setuptools_darcs-1.2.11-py2.6.egg/setuptools_darcs/setuptools_darcs.py
setuptools_darcs-1.2.11-py2.6.egg/share/doc/python-setuptools_darcs/README.txt
setuptools_trial/__init__.py
setuptools_trial/_version.py
setuptools_trial/setuptools_trial.py
setuptools_trial.egg-info/PKG-INFO
setuptools_trial.egg-info/SOURCES.txt
setuptools_trial.egg-info/dependency_links.txt
setuptools_trial.egg-info/entry_points.txt
setuptools_trial.egg-info/not-zip-safe
setuptools_trial.egg-info/requires.txt
setuptools_trial.egg-info/top_level.txt

View File

@ -0,0 +1,3 @@
[distutils.commands]
trial = setuptools_trial.setuptools_trial:TrialTest

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@
Twisted >= 2.4.0

View File

@ -0,0 +1 @@
setuptools_trial

View File

@ -0,0 +1,16 @@
# This is the version of this tree, as created by setup.py darcsver from the Darcs patch
# information: the main version number is taken from the most recent release
# tag. If some patches have been added since the last release, this will have a
# -NN "build number" suffix, or else a -rNN "revision number" suffix. Please see
# pyutil.version_class for a description of what the different fields mean.
verstr = "0.5.9"
try:
from pyutil.version_class import Version as pyutil_Version
__version__ = pyutil_Version(verstr)
except (ImportError, ValueError):
# Maybe there is no pyutil installed, or this may be an older version of
# pyutil.version_class which does not support SVN-alike revision numbers.
from distutils.version import LooseVersion as distutils_Version
__version__ = distutils_Version(verstr)

View File

@ -0,0 +1,106 @@
import sys
from setuptools.command import test
class TrialTest(test.test):
"""
Twisted Trial setuptools command
"""
user_options = test.test.user_options + [
('rterrors', 'e', "Realtime errors: print out tracebacks as soon as they occur."),
('debug-stacktraces', 'B', "Report Deferred creation and callback stack traces."),
('coverage','c', "Report coverage data."),
('reactor=','r', "which reactor to use"),
('reporter=', None, "Customize Trial's output with a Reporter plugin."),
('until-failure','u', "Repeat test until it fails."),
]
boolean_options = ['coverage', 'debug-stacktraces', 'rterrors']
def initialize_options(self):
test.test.initialize_options(self)
self.coverage = None
self.debug_stacktraces = None
self.reactor = None
self.reporter = None
self.rterrors = None
self.until_failure = None
def finalize_options(self):
if self.test_suite is None:
if self.test_module is None:
self.test_suite = self.distribution.test_suite
else:
self.test_suite = self.test_module
elif self.test_module:
raise DistutilsOptionError(
"You may specify a module or a suite, but not both"
)
self.test_args = self.test_suite
def run_tests(self):
# We do the import from Twisted inside the function instead of the top
# of the file because since Twisted is a setup_requires, we can't
# assume that Twisted will be installed on the user's system prior
# to using Tahoe, so if we don't do the import here, then importing
# from this plugin will fail.
from twisted.scripts import trial
# Handle parsing the trial options passed through the setuptools
# trial command.
cmd_options = []
if self.reactor is not None:
cmd_options.extend(['--reactor', self.reactor])
else:
# Cygwin requires the poll reactor to work at all. Linux requires the poll reactor
# to avoid twisted bug #3218. In general, the poll reactor is better than the
# select reactor, but it is not available on all platforms. According to exarkun on
# IRC, it is available but buggy on some versions of Mac OS X, so just because you
# can install it doesn't mean we want to use it on every platform.
# Unfortunately this leads to this error with some combinations of tools:
# twisted.python.usage.UsageError: The specified reactor cannot be used, failed with error: reactor already installed.
if sys.platform in ("cygwin"):
cmd_options.extend(['--reactor', 'poll'])
if self.reporter is not None:
cmd_options.extend(['--reporter', self.reporter])
if self.rterrors is not None:
cmd_options.append('--rterrors')
if self.debug_stacktraces is not None:
cmd_options.append('--debug-stacktraces')
config = trial.Options()
config.parseOptions(cmd_options)
args = self.test_args
if type(args) == str:
args = [args,]
config['tests'] = args
if self.coverage:
config.opt_coverage()
trial._initialDebugSetup(config)
trialRunner = trial._makeRunner(config)
suite = trial._getSuite(config)
# run the tests
if self.until_failure:
test_result = trialRunner.runUntilFailure(suite)
else:
test_result = trialRunner.run(suite)
# write coverage data
if config.tracer:
sys.settrace(None)
results = config.tracer.results()
results.write_results(show_missing=1, summary=False,
coverdir=config.coverdir)
if test_result.wasSuccessful():
sys.exit(0) # success
else:
sys.exit(1) # failure

View File

@ -0,0 +1,3 @@
Permission is hereby granted to any person obtaining a copy of this work to
deal in this work without restriction (including the rights to use, modify,
distribute, sublicense, and/or sell copies).

View File

@ -0,0 +1,83 @@
setuptools_trial Manual
=======================
About
-----
This is a plugin for setuptools that integrates Twisted trial. Once
installed, "python ./setup.py trial" will run the package's unit tests
using Twisted trial. The package can also optionally be configured so
that "python ./setup.py test" will use Twisted trial instead of pyunit
a.k.a. unittest.
Installation
------------
With easy_install:
easy_install setuptools_trial
Alternative manual installation:
tar -zxvf setuptools_trial-X.Y.Z.tar.gz
cd setuptools_trial-X.Y.Z
python setup.py install
Where X.Y.Z is a version number.
Alternative to make a specific package use setuptools_trial without
installing setuptools_trial into the system:
Put "setup_requires=['setuptools_trial']" in the call to setup() in
the package's setup.py file.
Usage
-----
To use this plugin, you must first package your python module with
`setup.py` and use setuptools. The former is well documented in the
distutils manual:
http://docs.python.org/dist/dist.html
To use setuptools instead of distutils, just edit `setup.py` and
change
from distutils.core import setup
to
from setuptools import setup
Once setuptools_trial is installed (either into the system or just for
the current package), then "python ./setup.py trial" will run trial on
the package.
You can then make "python ./setup.py test" use trial instead of pyunit
(unittest) by adding the following stanza to your project's setup.py:
[aliases]
test = trial
See also the output of "python ./setup.py trial --help" for usage
options.
References
----------
How to distribute Python modules with Distutils:
http://docs.python.org/dist/dist.html
Setuptools complete manual:
http://peak.telecommunity.com/DevCenter/setuptools
Thanks to Yannick Gingras for providing the prototype for this
README.txt.