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.
51 lines
1.0 KiB
51 lines
1.0 KiB
"""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) |
|
return root_dir / "test_data" |
|
|
|
|
|
@pytest.fixture |
|
def budget_example_file(example_root): |
|
return example_root / "Budget-Vorlage-2024.xlsx" |
|
|
|
|
|
@pytest.fixture |
|
def budget_example_workbook(budget_example_file): |
|
import openpyxl |
|
|
|
return openpyxl.open(budget_example_file) |
|
|
|
|
|
@pytest.fixture |
|
def budget_example_sheet(budget_example_workbook): |
|
sheets = budget_example_workbook.sheetnames |
|
first = sheets[0] |
|
return 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 |
|
|
|
return openpyxl.open(superx_example_file)
|
|
|