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

Move argv_handler fixture to conftest.

Use conftest module for fixtures we need in several test modules.
parent 26bd8f76
No related branches found
No related tags found
No related merge requests found
import pytest
import sys
@pytest.fixture(scope="function")
def argv_handler(request):
"""This fixture restores sys.argv and sys.stdin after tests.
"""
_argv_stored = sys.argv
_stdin_stored = sys.stdin
def teardown():
sys.argv = _argv_stored
sys.stdin = _stdin_stored
request.addfinalizer(teardown)
......@@ -22,19 +22,6 @@ class FakeRandom(object):
return elems[num]
@pytest.fixture(scope="function")
def argv_handler(request):
"""This fixture restores sys.argv and sys.stdin after tests.
"""
_argv_stored = sys.argv
_stdin_stored = sys.stdin
def teardown():
sys.argv = _argv_stored
sys.stdin = _stdin_stored
request.addfinalizer(teardown)
class TestDicewareModule(object):
def test_get_random_sources(self):
......
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