diff --git a/setup.cfg b/setup.cfg
index 60377b118aa7697530f40bba1e8ce974c4a73f84..eea600e77e8e2f2657d020a34acd3a0c3c3b9130 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -4,9 +4,7 @@ dev = develop easy_install diceware[tests]
 docs = develop easy_install diceware[docs]
 
 [pytest]
-# py.test 2.8.2 breaks with --doctest-modules
-# See https://github.com/pytest-dev/pytest/issues/1057
-addopts = --doctest-glob='*.rst'
+addopts = --doctest-modules --doctest-glob='*.rst'
           diceware tests docs README.rst
 
 [bdist_wheel]
diff --git a/setup.py b/setup.py
index ac7d2cde9656dca4fef6b441bcef56e9c00ac484..d6cb0de894ea4f72f74e6e7d42a578979d531a31 100644
--- a/setup.py
+++ b/setup.py
@@ -33,7 +33,8 @@ install_requires = [
     ]
 
 tests_require = [
-    'pytest >= 2.0.3',
+    # See tox.ini
+    'pytest >=2.0.3,<2.8.0',
     'coverage',
     ]
 
diff --git a/tox.ini b/tox.ini
index f9c230141a784c5a9e8e556c4706d3f0032b80a8..1ae511512fcc8363564ee0d38138b1dc7bbed96b 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,9 @@ envlist = flake8, pypy, py26, py27, py32, py33, py34, py35, coverage
 [testenv]
 usedevelop=True
 recreate=True
-deps=pytest
+# py.test 2.8.2 breaks with --doctest-modules in setup.cfg.
+# See https://github.com/pytest-dev/pytest/issues/1057
+deps=pytest>=2.0.3,<2.8.0
 commands=
   python setup.py test