|
1
|
|
|
# -*- coding: utf-8 -*- |
|
2
|
|
|
# conftest.py |
|
3
|
|
|
import logging |
|
4
|
|
|
|
|
5
|
|
|
import pytest |
|
6
|
|
|
|
|
7
|
|
|
LOGGER = logging.getLogger(__name__) |
|
8
|
|
|
|
|
9
|
|
|
|
|
10
|
|
|
@pytest.fixture(scope="function") |
|
11
|
|
|
def toomanyfirstnames_fixture(): |
|
12
|
|
|
LOGGER.info("Setting Up TooManyFirstNames Fixture ...") |
|
13
|
|
|
yield |
|
14
|
|
|
LOGGER.info("Tearing Down TooManyFirstNames Fixture ...") |
|
15
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
@pytest.fixture(scope="function") |
|
18
|
|
|
def name_fixture(): |
|
19
|
|
|
LOGGER.info("Setting Up Names Fixture ...") |
|
20
|
|
|
yield |
|
21
|
|
|
LOGGER.info("Tearing Down Names Fixture ...") |
|
22
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
@pytest.fixture(scope="function") |
|
25
|
|
|
def academic_fixture(): |
|
26
|
|
|
LOGGER.info("Setting Up Academic Fixture ...") |
|
27
|
|
|
yield |
|
28
|
|
|
LOGGER.info("Tearing Down Academic Fixture ...") |
|
29
|
|
|
|
|
30
|
|
|
|
|
31
|
|
|
@pytest.fixture(scope="function") |
|
32
|
|
|
def noble_fixture(): |
|
33
|
|
|
LOGGER.info("Setting Up Noble Fixture ...") |
|
34
|
|
|
yield |
|
35
|
|
|
LOGGER.info("Tearing Down Noble Fixture ...") |
|
36
|
|
|
|
|
37
|
|
|
|
|
38
|
|
|
@pytest.fixture(scope="function") |
|
39
|
|
|
def person_fixture(): |
|
40
|
|
|
LOGGER.info("Setting Up Person Fixture ...") |
|
41
|
|
|
yield |
|
42
|
|
|
LOGGER.info("Tearing Down Person Fixture ...") |
|
43
|
|
|
|
|
44
|
|
|
|
|
45
|
|
|
@pytest.fixture(scope="function") |
|
46
|
|
|
def politician_fixture(): |
|
47
|
|
|
LOGGER.info("Setting Up Politician Fixture ...") |
|
48
|
|
|
yield |
|
49
|
|
|
LOGGER.info("Tearing Down Politician Fixture ...") |
|
50
|
|
|
|
|
51
|
|
|
|
|
52
|
|
|
@pytest.fixture(scope="function") |
|
53
|
|
|
def mop_fixture(): |
|
54
|
|
|
LOGGER.info("Setting Up MoP Fixture ...") |
|
55
|
|
|
yield |
|
56
|
|
|
LOGGER.info("Tearing Down MoP Fixture ...") |
|
57
|
|
|
|
|
58
|
|
|
|
|
59
|
|
|
@pytest.fixture(scope="function") |
|
60
|
|
|
def notinrange_fixture(): |
|
61
|
|
|
LOGGER.info("Setting Up NotInRange Fixture ...") |
|
62
|
|
|
yield |
|
63
|
|
|
LOGGER.info("Tearing Down NotInRange Fixture ...") |
|
64
|
|
|
|
|
65
|
|
|
|
|
66
|
|
|
@pytest.fixture(scope="function") |
|
67
|
|
|
def attrdisplay_fixture(): |
|
68
|
|
|
LOGGER.info("Setting Up AttrDisplay Fixture ...") |
|
69
|
|
|
yield |
|
70
|
|
|
LOGGER.info("Tearing Down AttrDisplay Fixture ...") |
|
71
|
|
|
|
|
72
|
|
|
|
|
73
|
|
|
@pytest.fixture(scope="function") |
|
74
|
|
|
def first_names_fixture(): |
|
75
|
|
|
LOGGER.info("Setting Up FirstNames Fixture ...") |
|
76
|
|
|
yield |
|
77
|
|
|
LOGGER.info("Tearing Down FirstNames Fixture ...") |
|
78
|
|
|
|
|
79
|
|
|
|
|
80
|
|
|
@pytest.fixture(scope="function") |
|
81
|
|
|
def standardize_name_fixture(): |
|
82
|
|
|
LOGGER.info("Setting Up StandardizeName Fixture ...") |
|
83
|
|
|
yield |
|
84
|
|
|
LOGGER.info("Tearing Down StandardizeName Fixture ...") |
|
85
|
|
|
|
|
86
|
|
|
|
|
87
|
|
|
# https://stackoverflow.com/a/51742499/6597765 |
|
88
|
|
|
# @pytest.fixture(scope="function") |
|
89
|
|
|
# def cleanup_file_fixture(monkeypatch): |
|
90
|
|
|
# files = [] |
|
91
|
|
|
# monkeypatch.setattr(builtins, 'open', patch_open(builtins.open, files)) |
|
92
|
|
|
# monkeypatch.setattr(io, 'open', patch_open(io.open, files)) |
|
93
|
|
|
# yield |
|
94
|
|
|
# for file in files: |
|
95
|
|
|
# os.remove(file) |
|
96
|
|
|
|