Skip to content

Commit 7875210

Browse files
authored
Merge branch 'master' into feat/0.5.2-coverage-and-p0-hardening
2 parents 7e435a1 + e078452 commit 7875210

2 files changed

Lines changed: 13 additions & 22 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,8 @@ jobs:
4545
- run: pip install -e ".[dev]"
4646
- run: coverage run -m pytest
4747
- uses: codecov/codecov-action@v4
48-
if: always()
48+
if: always()
49+
with:
50+
token: ${{ secrets.CODECOV_TOKEN }}
51+
files: ./coverage.xml
52+
fail_ci_if_error: false

tests/test_protect_branches.py

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -472,30 +472,17 @@ def my_charge(amount):
472472
assert "my_charge" in rt.get_sensitive_tools()
473473

474474

475-
def test_sensitive_runtime_init_failure_raises(test_runtime, monkeypatch):
476-
"""If runtime construction fails inside @sensitive, the decorator
477-
MUST raise ``RuntimeError`` (fail-CLOSED, ADR-008). The original
478-
exception is chained via ``__cause__`` so callers can still inspect
479-
the root cause.
480-
"""
475+
def test_sensitive_runtime_init_failure_is_silent(test_runtime, monkeypatch):
476+
"""If runtime construction fails inside @sensitive, import must not crash."""
481477
from nullrun import decorators
482478

483-
original_exc = RuntimeError("x")
484-
monkeypatch.setattr(
485-
decorators,
486-
"_get_or_create_runtime",
487-
MagicMock(side_effect=original_exc),
488-
)
489-
490-
with pytest.raises(
491-
RuntimeError,
492-
match=r"@sensitive registration failed for 'f'",
493-
) as excinfo:
494-
@sensitive
495-
def f():
496-
return 1
479+
monkeypatch.setattr(decorators, "_get_or_create_runtime", MagicMock(side_effect=RuntimeError("x")))
480+
# Decorator must NOT raise even though registration failed.
481+
@sensitive
482+
def f():
483+
return 1
497484

498-
assert excinfo.value.__cause__ is original_exc
485+
assert f() == 1
499486

500487

501488
# ─── reset() ──────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)