Creating a budget overview from a SuperX export.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
""" 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 / "Verbrauchsmittel-Toto-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_Zahlen.xlsx"
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
def superx_example_workbook(superx_example_file):
|
|
|
|
import openpyxl
|
|
|
|
|
|
|
|
yield openpyxl.open(superx_example_file)
|