From c04e109446177bf32a8f912cc49d49373acd6e69 Mon Sep 17 00:00:00 2001
From: ulif <uli@gnufix.de>
Date: Fri, 24 Feb 2017 03:41:18 +0100
Subject: [PATCH] Integrate fixture funcs into single one.

And place the new, integrated fixture on top. We keep it in this
module (instead of moving it to conftest.py) because it contains
functionality related to randomsources only.
---
 tests/test_random_sources.py | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/tests/test_random_sources.py b/tests/test_random_sources.py
index cb5c5d2..d70367b 100644
--- a/tests/test_random_sources.py
+++ b/tests/test_random_sources.py
@@ -11,6 +11,16 @@ from diceware.random_sources import (
     )
 
 
+@pytest.fixture(scope="function")
+def fake_input(request, monkeypatch):
+    def handler(values):
+        mock = InputMock(values)
+        monkeypatch.setattr(
+            "diceware.random_sources.input_func", mock)
+        return mock
+    return handler
+
+
 class TestSystemRandomSource(object):
 
     def test_options_are_stored(self):
@@ -68,20 +78,6 @@ class TestSystemRandomSource(object):
         assert num > 0
 
 
-def fake_input_values(values, patch):
-    input_mock = InputMock(values)
-    patch.setattr(
-        "diceware.random_sources.input_func", input_mock)
-    return input_mock
-
-
-@pytest.fixture(scope="function")
-def fake_input(request, monkeypatch):
-    def handler(values):
-        return fake_input_values(values, monkeypatch)
-    return handler
-
-
 class TestRealDiceRandomSource(object):
 
     def test_raw_input_patch_works(self, capsys, fake_input):
-- 
GitLab