diff --git a/doc/testing.rst b/doc/testing.rst
index 706d52251846acbff851c1fb29f55066c2c81616..e7bf32f0b80062d85b55d1b242febcec98e7f034 100644
--- a/doc/testing.rst
+++ b/doc/testing.rst
@@ -31,6 +31,9 @@ PostgreSQL::
 
     $ pg_virtualenv bash -c 'MUTALYZER_TEST_DATABASE_URI=postgres://${PGUSER}:${PGPASSWORD}@${PGHOST}:${PGPORT}/${PGDATABASE} py.test'
 
+Similarly, the `MUTALYZER_TEST_REDIS_URI` specifies a Redis server to use for
+testing. If unspecified, a mock Redis server is used.
+
 Tests are `run automatically on Travis CI
 <https://travis-ci.org/mutalyzer/mutalyzer>`_ with SQLite, PostgreSQL, and
 MySQL, for each pull request and push on GitHub.
diff --git a/tests/utils.py b/tests/utils.py
index 6743804fdb528b75d0ffb3c1c2a90b821c9ae88f..0e77b291c48747a49da6dd7965826dd79be16053 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -11,6 +11,7 @@ import shutil
 import tempfile
 
 from mutalyzer.config import settings
+from mutalyzer.redisclient import client as redis
 from mutalyzer import db
 
 
@@ -27,11 +28,12 @@ class TestEnvironment(object):
         os.close(log_handle)
 
         database_uri = os.getenv('MUTALYZER_TEST_DATABASE_URI', 'sqlite://')
+        redis_uri = os.getenv('MUTALYZER_TEST_REDIS_URI', None)
 
         settings.configure({'DEBUG':        False,
                             'TESTING':      True,
                             'CACHE_DIR':    self.cache_dir,
-                            'REDIS_URI':    None,
+                            'REDIS_URI':    redis_uri,
                             'DATABASE_URI': database_uri,
                             'LOG_FILE':     self.log_file})
 
@@ -41,6 +43,9 @@ class TestEnvironment(object):
             db.Base.metadata.drop_all(db.session.get_bind())
             db.Base.metadata.create_all(db.session.get_bind())
 
+        if redis_uri is not None:
+            redis.flushdb()
+
         for fixture in fixtures:
             fixture()