Skip to content

Commit a9dbe43

Browse files
committed
refactor: update test for environment variable overrides
- Adjusted test to confirm that all environment variables correctly override their respective YAML values. - Removed redundant assertions for model_path and table_key, simplifying the test logic.
1 parent 57c212c commit a9dbe43

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

tests/test_config.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -72,30 +72,12 @@ def test_environment_variable_override():
7272

7373
specs = get_specs()
7474

75-
# Test that environment variables override defaults only when not specified in YAML
75+
# Test that environment variables override all YAML values (as designed)
7676
for batch_name, spec in specs.items():
77-
# gcp_project_id should be overridden since it's not in defaults.yaml
77+
# All environment variables should override their respective YAML values
7878
assert spec["gcp_project_id"] == test_project_id
79-
# model_path should keep its YAML value (either default or batch-specific)
80-
assert "model_path" in spec
81-
if batch_name in ["freq_example", "snowflake_example_simple", "bigquery_example_simple",
82-
"gtrends", "weather_forecast", "gsod"]:
83-
assert spec["model_path"] == "gs://andrewm4894-tmp/models"
84-
elif batch_name == "s3_example_simple":
85-
assert spec["model_path"] == "s3://andrewm4894-tmp/models"
86-
else:
87-
assert spec["model_path"] == "local://./models"
88-
# table_key should keep its YAML value (either default or batch-specific)
89-
assert "table_key" in spec
90-
if batch_name in ["gsod", "gtrends", "bigquery_example_simple", "freq_example"]:
91-
assert spec["table_key"] == "andrewm4894.metrics.metrics"
92-
elif batch_name in ["weather_forecast", "snowflake_example_simple"]:
93-
assert spec["table_key"] == "ANDREWM4894.METRICS.METRICS"
94-
elif batch_name == "hn_top_stories_scores":
95-
assert spec["table_key"] == "metrics_hackernews"
96-
else:
97-
# table_key should either be "metrics" or "metrics_<batch_name>"
98-
assert spec["table_key"] in ["metrics", f"metrics_{batch_name}"]
79+
assert spec["model_path"] == test_model_path
80+
assert spec["table_key"] == test_table_key
9981
finally:
10082
# Restore original environment variables
10183
for var, value in original_env.items():

0 commit comments

Comments
 (0)