From 0a4c99e70350d4ed9ae894b04a9046523424cd67 Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Tue, 26 Mar 2024 08:27:22 +1300 Subject: [PATCH] Remove not just the charm observers but any observers based in the charm. --- ops/testing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ops/testing.py b/ops/testing.py index 819bd85de..d63fda104 100644 --- a/ops/testing.py +++ b/ops/testing.py @@ -253,7 +253,7 @@ def _forget_charm(self): # self.charm.on._undefine_event(event_source) # type: ignore to_remove = [] for handle_path, name, emitter_path, kind in self.framework._observers: - if handle_path == self.charm.handle.path: + if handle_path.startswith(self.charm.handle.path): to_remove.append((handle_path, name, emitter_path, kind)) for obs in to_remove: self.framework._observers.remove(obs)