Change 'setup.py trial' and 'setup.py test' to use 'bin/tahoe debug trial'. refs #1296

This commit is contained in:
david-sarah 2011-01-18 18:45:32 -08:00
parent 8f0af33ba6
commit 7e413d4fa4
1 changed files with 42 additions and 15 deletions

View File

@ -68,11 +68,6 @@ if len(sys.argv) > 1 and sys.argv[1] == '--fakedependency':
install_requires += ["fakedependency >= 1.0.0"] install_requires += ["fakedependency >= 1.0.0"]
__requires__ = install_requires[:] __requires__ = install_requires[:]
if 'trial' in sys.argv or 'test' in sys.argv:
if version is not None:
__requires__.append(APPNAME + '==' + version)
else:
__requires__.append(APPNAME)
egg = os.path.realpath(glob.glob('setuptools-*.egg')[0]) egg = os.path.realpath(glob.glob('setuptools-*.egg')[0])
sys.path.insert(0, egg) sys.path.insert(0, egg)
@ -140,16 +135,13 @@ setup_requires = []
# http://pypi.python.org/pypi/darcsver # http://pypi.python.org/pypi/darcsver
setup_requires.append('darcsver >= 1.7.1') setup_requires.append('darcsver >= 1.7.1')
# Nevow requires Twisted to setup, but doesn't declare that requirement in a # Nevow requires Twisted to setup, but prior to Nevow v0.9.33, didn't
# way that enables setuptools to satisfy that requirement before Nevow's # declare that requirement in a way that enables setuptools to satisfy
# setup.py tried to "import twisted". Fortunately we require setuptools_trial # the requirement before Nevow's setup.py tries to "import twisted".
# to setup and setuptools_trial requires Twisted to install, so hopefully # This only matters when Twisted is not already installed.
# everything will work out until the Nevow issue is fixed: # See http://divmod.org/trac/ticket/2629
# http://divmod.org/trac/ticket/2629 setuptools_trial is needed if you want # Retire this hack if/when we require Nevow >= 0.9.33.
# "./setup.py trial" or "./setup.py test" to execute the tests (and in order setup_requires.append('Twisted >= 2.4.0')
# to make sure Twisted is installed early enough -- see the paragraph above).
# http://pypi.python.org/pypi/setuptools_trial
setup_requires.extend(['setuptools_trial >= 0.5'])
# setuptools_darcs is required to produce complete distributions (such # setuptools_darcs is required to produce complete distributions (such
# as with "sdist" or "bdist_egg"), unless there is a # as with "sdist" or "bdist_egg"), unless there is a
@ -248,6 +240,40 @@ class TestMacDiskImage(Command):
import test_mac_diskimage import test_mac_diskimage
return test_mac_diskimage.test_mac_diskimage('Allmydata', version=self.distribution.metadata.version) return test_mac_diskimage.test_mac_diskimage('Allmydata', version=self.distribution.metadata.version)
class Trial(Command):
description = "run trial (use 'bin%stahoe debug trial' for the full set of trial options)" % (os.sep,)
# This is just a subset of the most useful options, for compatibility.
user_options = [ ("rterrors", "e", "Print out tracebacks as soon as they occur."),
("reporter=", None, "The reporter to use for this test run."),
("suite=", "s", "Specify the test suite."),
("version-and-path", None, "Display version numbers and paths of Tahoe dependencies."),
]
def initialize_options(self):
self.rterrors = False
self.reporter = None
self.suite = "allmydata"
self.version_and_path = False
def finalize_options(self):
pass
def run(self):
args = [sys.executable, os.path.join('bin', 'tahoe')]
if self.version_and_path:
args.append('--version-and-path')
args += ['debug', 'trial']
if self.rterrors:
args.append('--rterrors')
if self.reporter:
args.append('--reporter=' + self.reporter)
if self.suite:
args.append(self.suite)
rc = subprocess.call(args)
sys.exit(rc)
class CheckAutoDeps(Command): class CheckAutoDeps(Command):
user_options = [] user_options = []
def initialize_options(self): def initialize_options(self):
@ -371,6 +397,7 @@ setup(name=APPNAME,
"run_with_pythonpath": RunWithPythonPath, "run_with_pythonpath": RunWithPythonPath,
"check_auto_deps": CheckAutoDeps, "check_auto_deps": CheckAutoDeps,
"test_mac_diskimage": TestMacDiskImage, "test_mac_diskimage": TestMacDiskImage,
"trial": Trial,
"make_executable": MakeExecutable, "make_executable": MakeExecutable,
"sdist": MySdist, "sdist": MySdist,
}, },