diff --git a/tests/conftest.py b/tests/conftest.py
index <HASH>..<HASH> 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -379,8 +379,10 @@ def dummy_mailer():
     from smtplib import SMTP
     from dallinger.heroku import messages
     server = mock.create_autospec(SMTP)
+    orig_server = messages.get_email_server
     messages.get_email_server = lambda: server
-    return server
+    yield server
+    messages.get_email_server = orig_server
 
 
 def pytest_addoption(parser):
diff --git a/tests/test_experiment_server.py b/tests/test_experiment_server.py
index <HASH>..<HASH> 100644
--- a/tests/test_experiment_server.py
+++ b/tests/test_experiment_server.py
@@ -336,6 +336,7 @@ class TestHandleError(object):
         dummy_mailer.sendmail.assert_called_once()
         assert dummy_mailer.sendmail.call_args[0][0] == u'test_error@gmail.com'
 
+
 @pytest.mark.usefixtures('experiment_dir', 'db_session')
 class TestWorkerFailed(object):
Fix style error and un-monkeypatch fixture.