Move all tests to be controlled by tox
diff --git a/.gitignore b/.gitignore
index 5d29a9f..3977f22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 *.py[co]
 __pycache__/
 _build/
+.tox/
diff --git a/.travis.yml b/.travis.yml
index 08fa5d0..fe46c7d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,15 @@
 language: python
-python:
-    - 2.6
-    - 2.7
-    - 3.2
-    - 3.3
+python: 2.7
+env:
+    - TOX_ENV=py26
+    - TOX_ENV=py27
+    - TOX_ENV=py32
+    - TOX_ENV=py33
+    - TOX_ENV=docs
+    - TOX_ENV=pep8
+
 install:
-    - pip install pytest flake8 sphinx
+    - pip install tox
+
 script:
-    - py.test
-    - "flake8 . --ignore='E128'"
-    - sphinx-build -W -bhtml docs/ docs/_build/html/
+    - tox -e $TOX_ENV
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..4a80fc8
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,16 @@
+[tox]
+envlist = py26,py27,pypy,py32,py33,docs,pep8
+
+[testenv]
+deps = pytest
+commands = py.test
+
+[testenv:docs]
+deps = sphinx
+basepython = python2.7
+changedir = docs
+commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . _build/html
+
+[testenv:pep8]
+deps = flake8
+commands = flake8 cryptography/ tests/ docs/