Skip to content

Commit 7c7a8f3

Browse files
anth-volkclaude
andcommitted
Fix three unit test collection errors
- Pass HUGGING_FACE_TOKEN to unit test step in pr.yaml so tests that transitively import huggingface.py can collect without crashing - Fix test_etl_national_targets.py: remove nonexistent TAX_EXPENDITURE_REFORM_ID import, use reform_id > 0 filter instead (mirrors fix from unmerged PR #664) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 88a029d commit 7c7a8f3

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

.github/workflows/pr.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ jobs:
7070
- name: Install package
7171
run: uv sync --dev
7272
- name: Run unit tests with coverage
73+
env:
74+
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
7375
run: >
7476
uv run pytest policyengine_us_data/tests/unit/
7577
--cov=policyengine_us_data

policyengine_us_data/tests/unit/test_etl_national_targets.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
create_database,
99
)
1010
from policyengine_us_data.db.etl_national_targets import (
11-
TAX_EXPENDITURE_REFORM_ID,
1211
load_national_targets,
1312
)
1413

@@ -90,13 +89,15 @@ def test_load_national_targets_deactivates_stale_baseline_rows(tmp_path, monkeyp
9089
tax_expenditure_df = pd.DataFrame(
9190
[
9291
{
92+
"reform_id": 1,
9393
"variable": "salt_deduction",
9494
"value": 21.247e9,
9595
"source": "Joint Committee on Taxation",
9696
"notes": "SALT deduction tax expenditure",
9797
"year": 2024,
9898
},
9999
{
100+
"reform_id": 5,
100101
"variable": "qualified_business_income_deduction",
101102
"value": 63.1e9,
102103
"source": "Joint Committee on Taxation",
@@ -124,16 +125,12 @@ def test_load_national_targets_deactivates_stale_baseline_rows(tmp_path, monkeyp
124125
assert stale_rows
125126
assert all(not target.active for target in stale_rows)
126127

127-
reform_rows = (
128-
session.query(Target)
129-
.filter(Target.reform_id == TAX_EXPENDITURE_REFORM_ID)
130-
.all()
131-
)
128+
reform_rows = session.query(Target).filter(Target.reform_id > 0).all()
132129
assert len(reform_rows) == 2
133130
assert all(target.active for target in reform_rows)
134-
assert {target.variable for target in reform_rows} == {
135-
"salt_deduction",
136-
"qualified_business_income_deduction",
131+
assert {(target.variable, target.reform_id) for target in reform_rows} == {
132+
("salt_deduction", 1),
133+
("qualified_business_income_deduction", 5),
137134
}
138135
assert all(
139136
"Modeled as repeal-based income tax expenditure target"

0 commit comments

Comments
 (0)