-
Notifications
You must be signed in to change notification settings - Fork 6
/
conftest.py
57 lines (45 loc) · 1.47 KB
/
conftest.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# This file is part of ipumspy.
# For copyright and licensing information, see the NOTICE and LICENSE files
# in this project's top-level directory, and also on-line at:
# https://github.com/ipums/ipumspy
from pathlib import Path
import pytest
from dotenv import load_dotenv
def pytest_addoption(parser):
parser.addoption(
"--runslow",
action="store_true",
default=False,
help="run slow tests",
)
parser.addoption(
"--runint",
action="store_true",
default=False,
help="run integration tests",
)
def pytest_collection_modifyitems(config, items):
skip_slow = pytest.mark.skip(reason="need --runslow option to run")
skip_int = pytest.mark.skip(reason="need --runint option to run")
for item in items:
if "slow" in item.keywords and not config.getoption("--runslow"):
item.add_marker(skip_slow)
@pytest.fixture(scope="session")
def environment_variables():
"""
Test envrionment variables are stored in .env.test
"""
filename = Path(__file__).parent / ".env.test"
load_dotenv(dotenv_path=filename)
@pytest.fixture(scope="session")
def fixtures_path() -> Path:
path = Path(__file__)
return path.absolute().parent / "tests" / "fixtures"
@pytest.fixture(scope="session")
def vcr_config():
return {
"filter_headers": ["authorization"],
"ignore_localhost": True,
"record_mode": "once",
"match_on": ["uri", "method"],
}