mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-02 19:26:44 +00:00
setup: remove 'trial' command. Tox is the way.
This removes the "setup.py trial" and "setup.py test" aliases from setup.cfg, and the custom Trial class from setup.py . Note that once you have tahoe installed into a virtualenv, "trial allmydata" is how tests are actually run (that's what tox does). Having a command for it in setup.py offered two things: a common setup.py-based target to start tests (like "make check" in a GNU/automake -style project), and a convenient way to get the PATH/PYTHONPATH right. "tox" is now the standard way to invoke tests in python projects, and tox sets up $PATH for us.
This commit is contained in:
parent
ae1b1e02fc
commit
ce088ad27c
@ -34,9 +34,7 @@ find_links=tahoe-deps ../tahoe-deps
|
|||||||
|
|
||||||
[aliases]
|
[aliases]
|
||||||
build = update_version build
|
build = update_version build
|
||||||
test = update_version build trial
|
|
||||||
sdist = update_version sdist
|
sdist = update_version sdist
|
||||||
install = update_version install
|
install = update_version install
|
||||||
develop = update_version develop
|
develop = update_version develop
|
||||||
bdist_egg = update_version bdist_egg
|
bdist_egg = update_version bdist_egg
|
||||||
trial = update_version trial
|
|
||||||
|
73
setup.py
73
setup.py
@ -95,75 +95,6 @@ trove_classifiers=[
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# We no longer have any requirements specific to tests.
|
|
||||||
tests_require=[]
|
|
||||||
|
|
||||||
|
|
||||||
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 = [ ("no-rterrors", None, "Don't print out tracebacks as they occur."),
|
|
||||||
("rterrors", "e", "Print out tracebacks as they occur (default, so ignored)."),
|
|
||||||
("until-failure", "u", "Repeat a test (specified by -s) until it fails."),
|
|
||||||
("reporter=", None, "The reporter to use for this test run."),
|
|
||||||
("suite=", "s", "Specify the test suite."),
|
|
||||||
("quiet", None, "Don't display version numbers and paths of Tahoe dependencies."),
|
|
||||||
("coverage", "c", "Collect branch coverage information."),
|
|
||||||
]
|
|
||||||
|
|
||||||
def initialize_options(self):
|
|
||||||
self.rterrors = False
|
|
||||||
self.no_rterrors = False
|
|
||||||
self.until_failure = False
|
|
||||||
self.reporter = None
|
|
||||||
self.suite = "allmydata"
|
|
||||||
self.quiet = False
|
|
||||||
self.coverage = False
|
|
||||||
|
|
||||||
def finalize_options(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
args = [sys.executable, os.path.join('bin', 'tahoe')]
|
|
||||||
|
|
||||||
if self.coverage:
|
|
||||||
from errno import ENOENT
|
|
||||||
coverage_cmd = 'coverage'
|
|
||||||
try:
|
|
||||||
subprocess.call([coverage_cmd, 'help'])
|
|
||||||
except OSError as e:
|
|
||||||
if e.errno != ENOENT:
|
|
||||||
raise
|
|
||||||
coverage_cmd = 'python-coverage'
|
|
||||||
try:
|
|
||||||
rc = subprocess.call([coverage_cmd, 'help'])
|
|
||||||
except OSError as e:
|
|
||||||
if e.errno != ENOENT:
|
|
||||||
raise
|
|
||||||
print >>sys.stderr
|
|
||||||
print >>sys.stderr, "Couldn't find the command 'coverage' nor 'python-coverage'."
|
|
||||||
print >>sys.stderr, "coverage can be installed using 'pip install coverage', or on Debian-based systems, 'apt-get install python-coverage'."
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
args += ['@' + coverage_cmd, 'run', '--branch', '--source=src/allmydata', '@tahoe']
|
|
||||||
|
|
||||||
if not self.quiet:
|
|
||||||
args.append('--version-and-path')
|
|
||||||
args += ['debug', 'trial']
|
|
||||||
if self.rterrors and self.no_rterrors:
|
|
||||||
raise AssertionError("--rterrors and --no-rterrors conflict.")
|
|
||||||
if not self.no_rterrors:
|
|
||||||
args.append('--rterrors')
|
|
||||||
if self.until_failure:
|
|
||||||
args.append('--until-failure')
|
|
||||||
if self.reporter:
|
|
||||||
args.append('--reporter=' + self.reporter)
|
|
||||||
if self.suite:
|
|
||||||
args.append(self.suite)
|
|
||||||
rc = subprocess.call(args)
|
|
||||||
sys.exit(rc)
|
|
||||||
|
|
||||||
|
|
||||||
GIT_VERSION_BODY = '''
|
GIT_VERSION_BODY = '''
|
||||||
# This _version.py is generated from git metadata by the tahoe setup.py.
|
# This _version.py is generated from git metadata by the tahoe setup.py.
|
||||||
|
|
||||||
@ -305,8 +236,7 @@ setup(name=APPNAME,
|
|||||||
author_email='tahoe-dev@tahoe-lafs.org',
|
author_email='tahoe-dev@tahoe-lafs.org',
|
||||||
url='https://tahoe-lafs.org/',
|
url='https://tahoe-lafs.org/',
|
||||||
license='GNU GPL', # see README.rst -- there is an alternative licence
|
license='GNU GPL', # see README.rst -- there is an alternative licence
|
||||||
cmdclass={"trial": Trial,
|
cmdclass={"update_version": UpdateVersion,
|
||||||
"update_version": UpdateVersion,
|
|
||||||
},
|
},
|
||||||
package_dir = {'':'src'},
|
package_dir = {'':'src'},
|
||||||
packages=['allmydata',
|
packages=['allmydata',
|
||||||
@ -325,7 +255,6 @@ setup(name=APPNAME,
|
|||||||
classifiers=trove_classifiers,
|
classifiers=trove_classifiers,
|
||||||
test_suite="allmydata.test",
|
test_suite="allmydata.test",
|
||||||
install_requires=install_requires,
|
install_requires=install_requires,
|
||||||
tests_require=tests_require,
|
|
||||||
package_data={"allmydata.web": ["*.xhtml",
|
package_data={"allmydata.web": ["*.xhtml",
|
||||||
"static/*.js", "static/*.png", "static/*.css",
|
"static/*.js", "static/*.png", "static/*.css",
|
||||||
"static/img/*.png",
|
"static/img/*.png",
|
||||||
|
Loading…
Reference in New Issue
Block a user