1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-06-04 01:21:03 +03:00

Move test & fixture into a class.

This is for then adding more tests.
This commit is contained in:
Athanasius 2021-03-19 14:38:53 +00:00
parent c344d612ad
commit 7bd6e8ff58

View File

@ -43,8 +43,11 @@ from config import config
from journal_lock import JournalLock
class TestJournalLock:
"""JournalLock test class."""
@pytest.fixture
def mock_journaldir(monkeypatch: _pytest_monkeypatch, tmpdir: _pytest_tmpdir) -> py_path_local_LocalPath:
def mock_journaldir(self, monkeypatch: _pytest_monkeypatch, tmpdir: _pytest_tmpdir) -> py_path_local_LocalPath:
"""Fixture for mocking config.get_str('journaldir')."""
def get_str(key: str, *, default: str = None) -> str:
"""Mock config.*Config get_str to provide fake journaldir."""
@ -59,8 +62,7 @@ def mock_journaldir(monkeypatch: _pytest_monkeypatch, tmpdir: _pytest_tmpdir) ->
m.setattr(config, "get_str", get_str)
yield tmpdir
def test_journal_lock_init(mock_journaldir: py_path_local_LocalPath):
def test_journal_lock_init(self, mock_journaldir: py_path_local_LocalPath):
"""Test JournalLock instantiation."""
tmpdir = mock_journaldir