Skip to content
Snippets Groups Projects
Commit c04e1094 authored by ulif's avatar ulif
Browse files

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.
parent 199f291f
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment