-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixtures.py
35 lines (30 loc) · 1010 Bytes
/
fixtures.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pytest
from jointSpendingCalculator import *
from unittest.mock import patch
@pytest.fixture
def directory():
with patch('builtins.input', return_value='test_data'):
DIRECTORY = find_folder()
return DIRECTORY
@pytest.fixture
def names():
with patch("builtins.input", return_value="Jan Sophie"):
NAMES = get_names()
return NAMES
@pytest.fixture()
def totals_spreadsheet(directory):
SPREADSHEET_NAME = "totals"
with patch("builtins.input", return_value=SPREADSHEET_NAME):
TOTALS_SPREADSHEET = create_totals_file(directory)
yield TOTALS_SPREADSHEET
os.remove(directory + TOTALS_SPREADSHEET)
@pytest.fixture
def statements(directory, totals_spreadsheet):
totals_spreadsheet_name = totals_spreadsheet
s = get_statements(directory, totals_spreadsheet_name)
return s
@pytest.fixture
def delete_html_file(directory, totals_spreadsheet):
yield
html_file = totals_spreadsheet[:-4] + '.html'
os.remove(directory + html_file)