Skip to content

Commit ee6dcfd

Browse files
committed
fix(ci): patch CI=true env in non-strict tests, add st.write mock
- test_core.py: 4 tests that expect non-strict error handling now patch CI="" to prevent auto-strict mode activation in GitHub Actions - test_dashboard.py: add missing st.write to MockStreamlit
1 parent 8651555 commit ee6dcfd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

tests/test_core.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def mock_single_control_policy():
106106
os.unlink(path)
107107

108108

109+
@patch.dict(os.environ, {"CI": "", "VENTURALITICA_STRICT": ""})
109110
def test_compute_and_evaluate_value_error(mock_single_control_policy):
110111
validator = AssuranceValidator(mock_single_control_policy)
111112
from venturalitica.metrics import METRIC_REGISTRY
@@ -118,6 +119,7 @@ def test_compute_and_evaluate_value_error(mock_single_control_policy):
118119
assert results == []
119120

120121

122+
@patch.dict(os.environ, {"CI": "", "VENTURALITICA_STRICT": ""})
121123
def test_compute_and_evaluate_unexpected_error(mock_single_control_policy, capsys):
122124
validator = AssuranceValidator(mock_single_control_policy)
123125
from venturalitica.metrics import METRIC_REGISTRY
@@ -185,6 +187,7 @@ def test_compute_and_evaluate_invalid_data():
185187
v.compute_and_evaluate("not a dataframe", {})
186188

187189

190+
@patch.dict(os.environ, {"CI": "", "VENTURALITICA_STRICT": ""})
188191
def test_unknown_metric(mock_policy_file):
189192
validator = AssuranceValidator(mock_policy_file)
190193
# Inject an unknown metric control into the policy object
@@ -202,6 +205,7 @@ def test_unknown_metric(mock_policy_file):
202205
assert not any(r.control_id == "U1" for r in results)
203206

204207

208+
@patch.dict(os.environ, {"CI": "", "VENTURALITICA_STRICT": ""})
205209
def test_unexpected_error_eval(mock_policy_file):
206210
validator = AssuranceValidator(mock_policy_file)
207211
from venturalitica.metrics import METRIC_REGISTRY

tests/test_dashboard.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def __init__(self):
2424
self.code = MagicMock()
2525
self.markdown = MagicMock()
2626
self.text = MagicMock()
27+
self.write = MagicMock()
2728
self.button = MagicMock(return_value=False)
2829
self.spinner = MagicMock()
2930
self.spinner.return_value.__enter__ = MagicMock()

0 commit comments

Comments
 (0)