Skip to content

Commit fa55feb

Browse files
committed
Use pytest-lazy-fixtures to only affect the environment in pertinent tests.
1 parent a36e1f2 commit fa55feb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ test = [
4343
"pytest-enabler",
4444
"pytest-ruff",
4545
"freezegun",
46+
"pytest-lazy-fixtures",
4647
]
4748

4849
[tool.setuptools]

tests/test_cli.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import freezegun
88
import pytest
9+
from pytest_lazy_fixtures import lf
910

1011
import csv2ofx.main
1112

@@ -100,7 +101,7 @@
100101
),
101102
(
102103
["-o", "-m amazon", "-e 20230604"],
103-
"amazon.csv",
104+
lf("amazon_inputs"),
104105
"amazon.ofx",
105106
),
106107
(
@@ -116,12 +117,13 @@
116117
]
117118

118119

119-
@pytest.fixture(autouse=True)
120-
def amazon_env(monkeypatch):
120+
@pytest.fixture
121+
def amazon_inputs(monkeypatch):
121122
# for Amazon import; excludes transaction 3/3
122123
monkeypatch.setenv("AMAZON_EXCLUDE_CARDS", "9876")
123124
# clear the purchases account if set
124125
monkeypatch.delenv("AMAZON_PURCHASES_ACCOUNT", raising=False)
126+
return "amazon.csv"
125127

126128

127129
data = pathlib.Path('data')

0 commit comments

Comments
 (0)