diff --git a/ops/testing.py b/ops/testing.py index 2050c583f..141c40916 100644 --- a/ops/testing.py +++ b/ops/testing.py @@ -286,6 +286,11 @@ def emit(self, source: 'framework.BoundEvent', *args: Any, forget_charm=True, ** # harness.charm.x = foo; harness.something_that_emits()? Probably that # should be invalid because you can't really do that in practice? + # Prepare for another emit(). + if forget_charm: + self._forget_charm() + self.make_charm() + # Re-emit any deferred events from the previous run. self.framework.reemit() @@ -310,11 +315,6 @@ def emit(self, source: 'framework.BoundEvent', *args: Any, forget_charm=True, ** # Emit pre-commit, commit, and save the snapshot. self._commit() - # Prepare for another emit(). - if forget_charm: - self._forget_charm() - self.make_charm() - # noinspection PyProtectedMember class Harness(Generic[CharmType]):