mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-31 16:36:20 +00:00
use_setuptools_trial.patch
This commit is contained in:
parent
4cd02cc12f
commit
5cd6ed17fb
8
Makefile
8
Makefile
@ -118,21 +118,21 @@ TEST=allmydata
|
|||||||
# suppress the ansi color sequences
|
# suppress the ansi color sequences
|
||||||
|
|
||||||
test: build src/allmydata/_version.py
|
test: build src/allmydata/_version.py
|
||||||
$(PYTHON) setup.py trial -a "$(TRIALARGS) $(TEST)"
|
$(PYTHON) setup.py trial $(TRIALARGS) -s $(TEST)
|
||||||
|
|
||||||
quicktest: .built .checked-deps
|
quicktest: .built .checked-deps
|
||||||
$(PYTHON) setup.py trial -a "$(TRIALARGS) $(TEST)"
|
$(PYTHON) setup.py trial $(TRIALARGS) -s $(TEST)
|
||||||
|
|
||||||
fuse-test: .built .checked-deps
|
fuse-test: .built .checked-deps
|
||||||
$(RUNPP) -d contrib/fuse -p -c runtests.py
|
$(RUNPP) -d contrib/fuse -p -c runtests.py
|
||||||
|
|
||||||
test-figleaf: build src/allmydata/_version.py
|
test-figleaf: build src/allmydata/_version.py
|
||||||
rm -f .figleaf
|
rm -f .figleaf
|
||||||
$(PYTHON) setup.py trial -a "--reporter=bwverbose-figleaf $(TEST)"
|
$(PYTHON) setup.py trial --reporter=bwverbose-figleaf -s $(TEST)
|
||||||
|
|
||||||
quicktest-figleaf: src/allmydata/_version.py
|
quicktest-figleaf: src/allmydata/_version.py
|
||||||
rm -f .figleaf
|
rm -f .figleaf
|
||||||
$(PYTHON) setup.py trial -a "--reporter=bwverbose-figleaf $(TEST)"
|
$(PYTHON) setup.py trial --reporter=bwverbose-figleaf -s $(TEST)
|
||||||
|
|
||||||
figleaf-output:
|
figleaf-output:
|
||||||
$(RUNPP) -p -c "misc/figleaf2html -d coverage-html -r src -x misc/figleaf.excludes"
|
$(RUNPP) -p -c "misc/figleaf2html -d coverage-html -r src -x misc/figleaf.excludes"
|
||||||
|
52
setup.py
52
setup.py
@ -121,6 +121,7 @@ else:
|
|||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
from setuptools.command import sdist
|
from setuptools.command import sdist
|
||||||
from distutils.core import Command
|
from distutils.core import Command
|
||||||
|
from setuptools_trial.setuptools_trial import TrialTest
|
||||||
|
|
||||||
# Make the dependency-version-requirement, which is used by the Makefile at
|
# Make the dependency-version-requirement, which is used by the Makefile at
|
||||||
# build-time, also available to the app at runtime:
|
# build-time, also available to the app at runtime:
|
||||||
@ -192,7 +193,7 @@ setup_requires = []
|
|||||||
|
|
||||||
# Nevow requires Twisted to setup, but doesn't declare that requirement in a way that enables
|
# Nevow requires Twisted to setup, but doesn't declare that requirement in a way that enables
|
||||||
# setuptools to satisfy that requirement before Nevow's setup.py tried to "import twisted".
|
# setuptools to satisfy that requirement before Nevow's setup.py tried to "import twisted".
|
||||||
setup_requires.append('Twisted >= 2.4.0')
|
setup_requires.extend(['Twisted >= 2.4.0', 'setuptools_trial'])
|
||||||
|
|
||||||
# darcsver is needed only if you want "./setup.py darcsver" to write a new
|
# darcsver is needed only if you want "./setup.py darcsver" to write a new
|
||||||
# version stamp in src/allmydata/_version.py, with a version number derived from
|
# version stamp in src/allmydata/_version.py, with a version number derived from
|
||||||
@ -318,59 +319,26 @@ class BuildTahoe(Command):
|
|||||||
print >>sys.stderr, "'setup.py develop' exited with rc", rc
|
print >>sys.stderr, "'setup.py develop' exited with rc", rc
|
||||||
sys.exit(rc)
|
sys.exit(rc)
|
||||||
|
|
||||||
class Trial(Command):
|
class Trial(TrialTest):
|
||||||
# Unlike 'build' and 'bdist_egg', the 'trial' subcommand cannot be run in
|
# Custom sub-class of the TrialTest class from the setuptools_trial
|
||||||
# conjunction with other subcommands.
|
# plugin so that we can ensure certain options are set by default.
|
||||||
|
#
|
||||||
# The '-a' argument is split on whitespace and passed into trial. (the
|
|
||||||
# distutils parser does not give subcommands access to the rest of
|
|
||||||
# sys.argv, so unfortunately we cannot just do something like:
|
|
||||||
# setup.py trial --reporter=text allmydata.test.test_util
|
|
||||||
|
|
||||||
# Examples:
|
# Examples:
|
||||||
# setup.py trial # run all tests
|
# setup.py trial # run all tests
|
||||||
# setup.py trial -a allmydata.test.test_util # run some tests
|
# setup.py trial -a allmydata.test.test_util # run some tests
|
||||||
# setup.py trial -a '--reporter=text allmydata.test.test_util' #other args
|
# setup.py trial -a '--reporter=text allmydata.test.test_util' #other args
|
||||||
|
|
||||||
description = "Run unit tests via trial"
|
|
||||||
|
|
||||||
user_options = [ ("args=", "a", "Argument string to pass to trial: setup.py trial -a allmydata.test.test_util"),
|
|
||||||
]
|
|
||||||
def initialize_options(self):
|
def initialize_options(self):
|
||||||
self.args = "allmydata"
|
TrialTest.initialize_options(self)
|
||||||
def finalize_options(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def run(self):
|
# We want to set the reactor to 'poll', because of bug #402
|
||||||
# make sure Twisted is available (for trial itself), and both the
|
# (twisted bug #3218).
|
||||||
# Tahoe source code and our dependent libraries are available (so
|
|
||||||
# that trial has some test code to work with)
|
|
||||||
|
|
||||||
from twisted.scripts import trial
|
|
||||||
|
|
||||||
args = self.args.strip().split()
|
|
||||||
|
|
||||||
# one wrinkle: we want to set the reactor here, because of bug #402
|
|
||||||
# (twisted bug #3218). We just jam in a "--reactor poll" at the start
|
|
||||||
# of the arglist. This does not permit the reactor to be overridden,
|
|
||||||
# unfortunately.
|
|
||||||
if sys.platform in ("linux2", "cygwin"):
|
if sys.platform in ("linux2", "cygwin"):
|
||||||
# poll on linux2 to avoid #402 problems with select
|
# poll on linux2 to avoid #402 problems with select
|
||||||
# poll on cygwin since selectreactor runs out of fds
|
# poll on cygwin since selectreactor runs out of fds
|
||||||
args = ["--reactor", "poll"] + args
|
self.reactor = "poll"
|
||||||
|
|
||||||
# zooko also had os.environ["PYTHONUNBUFFERED"]="1" and
|
|
||||||
# args.append("--rterrors")
|
|
||||||
|
|
||||||
sys.argv = ["trial"] + args
|
|
||||||
if self.verbose > 1:
|
|
||||||
print "To run this test directly, use:"
|
|
||||||
print "PYTHONPATH=%s %s" % (os.environ["PYTHONPATH"],
|
|
||||||
" ".join(sys.argv))
|
|
||||||
else:
|
|
||||||
print "(run setup.py with -vv for trial command-line details)"
|
|
||||||
trial.run() # this does sys.exit
|
|
||||||
# NEVER REACHED
|
|
||||||
|
|
||||||
class MySdist(sdist.sdist):
|
class MySdist(sdist.sdist):
|
||||||
""" A hook in the sdist command so that we can determine whether this the
|
""" A hook in the sdist command so that we can determine whether this the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user