|
|
|
""" Global test fixtures and Mocks """
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
|
class MockWorkbookSheet:
|
|
|
|
def __init__(self, data):
|
|
|
|
self._data = data
|
|
|
|
|
|
|
|
@property
|
|
|
|
def rows(self):
|
|
|
|
return iter(self._data)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def example_root(request):
|
|
|
|
root_dir = Path(request.config.rootdir)
|
|
|
|
yield root_dir / "test_data"
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def budget_example_file(example_root):
|
|
|
|
return example_root / "Budget-Vorlage-2020.xlsx"
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def budget_example_workbook(budget_example_file):
|
|
|
|
import openpyxl
|
|
|
|
|
|
|
|
yield openpyxl.open(budget_example_file)
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def budget_example_sheet(budget_example_workbook):
|
|
|
|
sheets = budget_example_workbook.sheetnames
|
|
|
|
first = sheets[0]
|
|
|
|
yield budget_example_workbook[first]
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def superx_example_file(example_root):
|
|
|
|
return example_root / "Verwendungsnachweis_und_Kassenstand_SAP.xlsx"
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def superx_example_workbook(superx_example_file):
|
|
|
|
import openpyxl
|
|
|
|
|
|
|
|
yield openpyxl.open(superx_example_file)
|