Skip to content

Commit

Permalink
Add tox
Browse files Browse the repository at this point in the history
Switches Travis from three executors to one. The concurrency limits
are still needed in the event that multiple pushes happen while tests
are running, but this makes tests run faster because the container
only needs to be setup once. It also makes running tests locally against
multiple Python versions simpler.
  • Loading branch information
jtatum committed Apr 29, 2016
1 parent 9836a5f commit a6a672d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.env
/.tox/
*.pyc
*#
*~
Expand Down
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
sudo: false
language: python
python:
- 2.7
- 3.4
- 3.5
python: 3.5
cache:
directories:
- $HOME/.cache/pip
- $TRAVIS_BUILD_DIR/.tox
before_install:
- mkdir -p $HOME/opt/local/bin
- export PATH=$HOME/opt/local/bin:$PATH
Expand All @@ -15,8 +13,8 @@ before_install:
- cp scripts/slackbot-test-ctl $HOME/opt/local/bin
- slackbot-test-ctl init
- slackbot-test-ctl startproxy
install: pip install -r requirements.txt
script: py.test -s -vv
install: pip install tox
script: tox
deploy:
provider: pypi
distributions: sdist bdist_wheel
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ $ py.test

If you're signed into slack, you'll see your user account and bot account chatting with each other as the tests run.

Tox is also available. If your system has Python 2.7, 3.4, and 3.5 installed, installing and running tox will automatically manage the virtual Python environments and dependencies for you.

### Configure Travis

Log in to Travis and enable tests for your slackbot fork. Open Travis settings. You must add the following environment variables, which should correlate to settings in `slackbot_test_settings.py`:
Expand Down
2 changes: 1 addition & 1 deletion scripts/slackbot-test-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ main() {
pkill -f "ssserver -c $ssconfig"
;;
run)
proxychains4 -f $proxychainsconfig "$@"
exec proxychains4 -f $proxychainsconfig "$@"
;;
*)
echo "WARNING: unknown command $action"
Expand Down
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[tox]
envlist = py27,py34,py35
[testenv]
deps =
pytest
commands = py.test -s -vv
passenv = SLACKBOT_* TRAVIS

0 comments on commit a6a672d

Please sign in to comment.