harshith1118 commented on code in PR #1402:
URL: https://github.com/apache/hamilton/pull/1402#discussion_r2404106785
##########
tests/cli/test_logic.py:
##########
@@ -93,3 +93,44 @@ def test_diff_node_versions():
assert diff["reference_only"] == ["orders_per_customer"]
assert diff["current_only"] == ["orders_per_distributor"]
assert diff["edit"] == ["average_order_by_customer",
"customer_summary_table"]
+
+
+def test_load_context_from_toml():
+ """Test loading context from a TOML file with top-level Hamilton
headers."""
+ import os
+ os.environ["HAMILTON_CONFIG"] = "HAMILTON_CONFIG"
+ os.environ["HAMILTON_FINAL_VARS"] = "HAMILTON_FINAL_VARS"
+ os.environ["HAMILTON_INPUTS"] = "HAMILTON_INPUTS"
+ os.environ["HAMILTON_OVERRIDES"] = "HAMILTON_OVERRIDES"
Review Comment:
Thank you for pointing out the test isolation issue! You're absolutely right
that directly
setting environment variables with `os.environ` can impact other tests
in the same process. I've
updated both TOML test functions to use the `monkeypatch` fixture
instead:
1. Updated `test_load_context_from_toml(monkeypatch)` to use
`monkeypatch.setenv()`
2. Updated `test_load_context_from_toml_tool_hamilton(monkeypatch)` to
use `monkeypatch.setenv()`
These changes ensure that environment variable modifications are
properly isolated to each test
and automatically cleaned up afterward, preventing any side effects on
other tests in the suite.
The changes have been committed and pushed to the PR branch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]