diff --git a/tests/test_random_sources.py b/tests/test_random_sources.py
index 0a89343d9f7979d9c9394208acd7fe7be20549b1..bea9b06e6d8f0cf0d86f563601f65a1fef286cd4 100644
--- a/tests/test_random_sources.py
+++ b/tests/test_random_sources.py
@@ -75,14 +75,21 @@ def fake_input_values(values, patch):
     return input_mock
 
 
+@pytest.fixture(scope="function")
+def fake_input_handler(request, monkeypatch):
+    def handler(values):
+        return fake_input_values(values, monkeypatch)
+    return handler
+
+
 class TestRealDiceRandomSource(object):
 
-    def test_raw_input_patch_works(self, monkeypatch, capsys):
+    def test_raw_input_patch_works(self, capsys, fake_input_handler):
         # make sure our fake input works. We try to fake input ('foo',
         # 'bar') and make sure that output is captured.
         # This test is just a hint, how input could be faked in real tests.
         # It can (and should) be removed if not needed any more.
-        fake_input_values(["foo", "bar"], monkeypatch)
+        fake_input_handler(["foo", "bar"])
         # late import, because we need the patched version
         from diceware.random_sources import input_func
         result1 = input_func("Enter some values: ")