diff --git a/tests/unit/test_patch_scope.py b/tests/unit/test_patch_scope.py index fc533bf4..42316d68 100644 --- a/tests/unit/test_patch_scope.py +++ b/tests/unit/test_patch_scope.py @@ -100,6 +100,10 @@ def _getmembers(obj): monkeypatch.setattr( triton_frontend.tl.core, "is_builtin", lambda member: member is sentinel ) + # The frontend caches each object's builtin names on first use; under the + # fake getmembers it would cache almost none, and every later unpatch_lang + # in the process would then leave triton.language patched. + monkeypatch.setattr(triton_frontend.frontend, "_triton_builtin_attr_cache", {}) scope = triton_frontend.frontend._triton_snapshot_scope(_dummy_kernel) replacement = lambda *_args, **_kwargs: None