From 23f871a4090440161b696bfefeb864c108413915 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Tue, 12 Apr 2016 12:15:42 -0700 Subject: [PATCH] add [test] "extra" to install testing-only dependencies closes ticket:2776 --- .travis.yml | 4 ++-- docs/INSTALL.rst | 15 ++++++++------- setup.py | 2 ++ topfiles/2776.change | 5 +++++ tox.ini | 3 +++ 5 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 topfiles/2776.change diff --git a/.travis.yml b/.travis.yml index 26ff9a89e..1aec3a306 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,9 +13,9 @@ before_install: - git fetch --depth=1000 - python misc/build_helpers/show-tool-versions.py install: - - pip install coverage coveralls + - pip install coveralls before_script: - - pip install -e . + - pip install -e .[test] script: - coverage run --branch --source=src/allmydata `which tahoe` --version-and-path debug trial --rterrors --reporter=timing after_success: diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst index 2b7455823..8d10cd6d8 100644 --- a/docs/INSTALL.rst +++ b/docs/INSTALL.rst @@ -203,7 +203,8 @@ Hacking On Tahoe-LAFS --------------------- To modify the Tahoe source code, you should get a git checkout, and install -with the ``--editable`` flag:: +with the ``--editable`` flag. You should also use the ``[test]`` extra to get +the additional libraries needed to run the unit tests:: % git clone https://github.com/tahoe-lafs/tahoe-lafs.git @@ -211,7 +212,7 @@ with the ``--editable`` flag:: % virtualenv venv - % venv/bin/pip install --editable . + % venv/bin/pip install --editable .[test] Obtaining file::~/tahoe-lafs ... Successfully installed ... @@ -257,11 +258,11 @@ into your tahoe-specific virtualenv with ``pip install tox``. Then just run ``tox``. This will create a new fresh virtualenv, install Tahoe (from the source tree, including any changes you have made) and all its -dependencies into the virtualenv, then run the unit tests. This ensures that -the tests are repeatable and match the results of other users, unaffected by -any other Python packages installed on your machine. On a modern computer -this will take 5-10 minutes, and should result in a "all tests passed" -mesage:: +dependencies (including testing-only dependencies) into the virtualenv, then +run the unit tests. This ensures that the tests are repeatable and match the +results of other users, unaffected by any other Python packages installed on +your machine. On a modern computer this will take 5-10 minutes, and should +result in a "all tests passed" mesage:: % tox GLOB sdist-make: ~/tahoe-lafs/setup.py diff --git a/setup.py b/setup.py index d7c866f06..c836b30fa 100644 --- a/setup.py +++ b/setup.py @@ -267,6 +267,8 @@ setup(name=APPNAME, classifiers=trove_classifiers, test_suite="allmydata.test", install_requires=install_requires, + extras_require={"test": ["pyflakes", "coverage"], + }, package_data={"allmydata.web": ["*.xhtml", "static/*.js", "static/*.png", "static/*.css", "static/img/*.png", diff --git a/topfiles/2776.change b/topfiles/2776.change new file mode 100644 index 000000000..01a19e6b0 --- /dev/null +++ b/topfiles/2776.change @@ -0,0 +1,5 @@ +Tahoe's testing-only dependencies can now be installed by asking for the +[test] extra, so if you want to set up a virtualenv for testing, use "pip +install -e .[test]" instead just of "pip install -e ." . At the moment this +only includes "coverage" and "pyflakes", but in the future it might include +"mock" and other utility libraries. diff --git a/tox.ini b/tox.ini index 1028928ec..002b481db 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,7 @@ envlist = py27 [testenv] passenv = USERPROFILE HOMEDRIVE HOMEPATH +deps = .[test] commands = tahoe --version trial --rterrors {posargs:allmydata} @@ -15,6 +16,7 @@ commands = [testenv:deprecations] basepython=python2.7 passenv = USERPROFILE HOMEDRIVE HOMEPATH +deps = .[test] setenv = PYTHONWARNINGS=default::DeprecationWarning commands = @@ -26,6 +28,7 @@ passenv = USERPROFILE HOMEDRIVE HOMEPATH setenv = PYTHONWARNINGS=default::DeprecationWarning deps = + .[test] git+https://github.com/twisted/twisted git+https://github.com/warner/foolscap commands =