Skip to content

Commit

Permalink
add [test] "extra" to install testing-only dependencies
Browse files Browse the repository at this point in the history
closes ticket:2776
  • Loading branch information
warner committed Apr 12, 2016
1 parent 359c233 commit 23f871a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 8 additions & 7 deletions docs/INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,16 @@ 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
% cd tahoe-lafs
% virtualenv venv
% venv/bin/pip install --editable .
% venv/bin/pip install --editable .[test]
Obtaining file::~/tahoe-lafs
...
Successfully installed ...
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ def try_from_git(self):
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",
Expand Down
5 changes: 5 additions & 0 deletions topfiles/2776.change
Original file line number Diff line number Diff line 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.
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ envlist = py27

[testenv]
passenv = USERPROFILE HOMEDRIVE HOMEPATH
deps = .[test]
commands =
tahoe --version
trial --rterrors {posargs:allmydata}

[testenv:deprecations]
basepython=python2.7
passenv = USERPROFILE HOMEDRIVE HOMEPATH
deps = .[test]
setenv =
PYTHONWARNINGS=default::DeprecationWarning
commands =
Expand All @@ -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 =
Expand Down

2 comments on commit 23f871a

@daira
Copy link
Member

@daira daira commented on 23f871a Apr 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sigh, another thing for me to remember to always do.

@warner
Copy link
Member Author

@warner warner commented on 23f871a Apr 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just run "tox" and use the virtualenv that it creates:

% tox
...
% source .tox/py27/bin/activate
(py27) % trial allmydata.test

Please sign in to comment.