Skip to content

Commit bbcf3ab

Browse files
test: restore the previous hub-user override on teardown rather than popping it
Other modules install theirs at import time; popping left later modules running against the real dependency. Surfaced by the same pattern in #21. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 910be92 commit bbcf3ab

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎app/tests/test_internal_secret.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,16 @@
4141
@pytest.fixture(autouse=True)
4242
def _env(monkeypatch):
4343
monkeypatch.setenv("TEST_STATUS_LIST_DIR", TESTKIT)
44+
# Other modules install their hub-user override at import time, which is
45+
# before this fixture runs and after it would have popped. Restore rather
46+
# than pop, or every later module runs against the real dependency.
47+
previous = app.dependency_overrides.get(require_hub_user)
4448
app.dependency_overrides[require_hub_user] = lambda: {"sub": "pancake-forwarded@demo.com"}
4549
yield
46-
app.dependency_overrides.pop(require_hub_user, None)
50+
if previous is None:
51+
app.dependency_overrides.pop(require_hub_user, None)
52+
else:
53+
app.dependency_overrides[require_hub_user] = previous
4754

4855

4956
@pytest.fixture

0 commit comments

Comments
 (0)